Package org.opentrafficsim.core.gtu
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.
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The type of relative position, e.g., Front, Back, etc. -
Field Summary
Modifier and TypeFieldDescriptionstatic final RelativePosition.Type
Standard relative position type CENTER.static final RelativePosition.Type
Standard relative position type CONTOUR.static final RelativePosition.Type
Standard relative position type DRIVER.static final RelativePosition.Type
Standard relative position type FRONT.static final RelativePosition.Type
Standard relative position type BACK.static final RelativePosition.Type
Standard relative position type REFERENCE.static final RelativePosition
The reference position (always 0, 0, 0). -
Constructor Summary
ConstructorDescriptionRelativePosition
(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 aRelativePosition
record class. -
Method Summary
Modifier and TypeMethodDescriptionorg.djunits.value.vdouble.scalar.Length
dx()
Returns the value of thedx
record component.org.djunits.value.vdouble.scalar.Length
dy()
Returns the value of thedy
record component.org.djunits.value.vdouble.scalar.Length
dz()
Returns the value of thedz
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Field Details
-
FRONT
Standard relative position type FRONT. -
REAR
Standard relative position type BACK. -
CENTER
Standard relative position type CENTER. -
REFERENCE
Standard relative position type REFERENCE. -
DRIVER
Standard relative position type DRIVER. -
CONTOUR
Standard relative position type CONTOUR. There can be multiple points of type CONTOUR for one GTU. -
REFERENCE_POSITION
The reference position (always 0, 0, 0).
-
-
Constructor Details
-
RelativePosition
- 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 aRelativePosition
record class.
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
dx
public org.djunits.value.vdouble.scalar.Length dx()Returns the value of thedx
record component.- Returns:
- the value of the
dx
record component
-
dy
public org.djunits.value.vdouble.scalar.Length dy()Returns the value of thedy
record component.- Returns:
- the value of the
dy
record component
-
dz
public org.djunits.value.vdouble.scalar.Length dz()Returns the value of thedz
record component.- Returns:
- the value of the
dz
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-