Record Class RelativePosition

java.lang.Object
java.lang.Record
org.opentrafficsim.core.gtu.RelativePosition
Record Components:
dx - Length; positive x is in the normal direction of movement.
dy - Length; positive y is left compared to the normal direction of movement (seen from the top).
dz - Length; positive z is up.
type - TYPE; type of relative position (FRONT, BACK, etc.).
All Implemented Interfaces:
Serializable

public record RelativePosition(org.djunits.value.vdouble.scalar.Length dx, org.djunits.value.vdouble.scalar.Length dy, org.djunits.value.vdouble.scalar.Length dz, RelativePosition.Type type) extends Record implements Serializable
A RelativePosition is a position on a GTU; e.g. the front, rear, position of the driver, etc.
A RelativePosition stores the offset of the position from the reference position of the GTU.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

$LastChangedDate$, @version $Revision$, by $Author$, initial version Dec 30, 2014

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also:
  • Field Details

    • FRONT

      public static final RelativePosition.Type FRONT
      Standard relative position type FRONT.
    • REAR

      public static final RelativePosition.Type REAR
      Standard relative position type BACK.
    • CENTER

      public static final RelativePosition.Type CENTER
      Standard relative position type CENTER.
    • REFERENCE

      public static final RelativePosition.Type REFERENCE
      Standard relative position type REFERENCE.
    • DRIVER

      public static final RelativePosition.Type DRIVER
      Standard relative position type DRIVER.
    • CONTOUR

      public static final RelativePosition.Type CONTOUR
      Standard relative position type CONTOUR. There can be multiple points of type CONTOUR for one GTU.
    • REFERENCE_POSITION

      public static final RelativePosition REFERENCE_POSITION
      The reference position (always 0, 0, 0).
  • Constructor Details

    • RelativePosition

      public RelativePosition(RelativePosition p)
      Parameters:
      p - RelativePosition; a relative position to make a deep copy of.
    • RelativePosition

      public RelativePosition(org.djunits.value.vdouble.scalar.Length dx, org.djunits.value.vdouble.scalar.Length dy, org.djunits.value.vdouble.scalar.Length dz, RelativePosition.Type type)
      Creates an instance of a RelativePosition record class.
      Parameters:
      dx - the value for the dx record component
      dy - the value for the dy record component
      dz - the value for the dz record component
      type - the value for the type record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • dx

      public org.djunits.value.vdouble.scalar.Length dx()
      Returns the value of the dx record component.
      Returns:
      the value of the dx record component
    • dy

      public org.djunits.value.vdouble.scalar.Length dy()
      Returns the value of the dy record component.
      Returns:
      the value of the dy record component
    • dz

      public org.djunits.value.vdouble.scalar.Length dz()
      Returns the value of the dz record component.
      Returns:
      the value of the dz record component
    • type

      public RelativePosition.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component