Package org.opentrafficsim.core.gtu
Record Class RelativePosition
java.lang.Object
java.lang.Record
org.opentrafficsim.core.gtu.RelativePosition
- Record Components:
dx- positive x is in the normal direction of movement.dy- positive y is left compared to the normal direction of movement (seen from the top).dz- positive z is up.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
Nested ClassesModifier and TypeClassDescriptionstatic classThe type of relative position, e.g., Front, Back, etc. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RelativePosition.TypeStandard relative position type CENTER.static final RelativePosition.TypeStandard relative position type CONTOUR.static final RelativePosition.TypeStandard relative position type DRIVER.static final RelativePosition.TypeStandard relative position type FRONT.static final RelativePosition.TypeStandard relative position type BACK.static final RelativePosition.TypeStandard relative position type REFERENCE.static final RelativePositionThe reference position (always 0, 0, 0). -
Constructor Summary
ConstructorsConstructorDescriptionRelativePosition(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 aRelativePositionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.djunits.value.vdouble.scalar.Lengthdx()Returns the value of thedxrecord component.org.djunits.value.vdouble.scalar.Lengthdy()Returns the value of thedyrecord component.org.djunits.value.vdouble.scalar.Lengthdz()Returns the value of thedzrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord 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- 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 aRelativePositionrecord 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 thedxrecord component.- Returns:
- the value of the
dxrecord component
-
dy
public org.djunits.value.vdouble.scalar.Length dy()Returns the value of thedyrecord component.- Returns:
- the value of the
dyrecord component
-
dz
public org.djunits.value.vdouble.scalar.Length dz()Returns the value of thedzrecord component.- Returns:
- the value of the
dzrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-