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.).
public record RelativePosition(Length dx, Length dy, Length dz, RelativePosition.Type type)
extends Record
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
-
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(Length dx, Length dy, Length dz, RelativePosition.Type type) Creates an instance of aRelativePositionrecord class.Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondx()Returns the value of thedxrecord component.dy()Returns the value of thedyrecord component.dz()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
Constructor.- Parameters:
p- a relative position to make a deep copy of.
-
RelativePosition
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
Returns the value of thedxrecord component.- Returns:
- the value of the
dxrecord component
-
dy
Returns the value of thedyrecord component.- Returns:
- the value of the
dyrecord component
-
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
-