Package org.opentrafficsim.core.gtu
Class RelativePosition
java.lang.Object
org.opentrafficsim.core.gtu.RelativePosition
- All Implemented Interfaces:
java.io.Serializable
public class RelativePosition
extends java.lang.Object
implements java.io.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-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2019-03-16 19:17:15 +0100 (Sat, 16 Mar 2019) $, @version $Revision: 5157 $, by $Author: averbraeck $,
initial version Dec 30, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RelativePosition.TYPE
The type of relative position, e.g., Front, Back, etc. -
Field Summary
Fields Modifier and Type Field Description static RelativePosition.TYPE
CENTER
Standard relative position type CENTER.static RelativePosition.TYPE
CENTER_GRAVITY
Center of gravity.static RelativePosition.TYPE
CONTOUR
Standard relative position type CONTOUR.static RelativePosition.TYPE
DRIVER
Standard relative position type DRIVER.static RelativePosition.TYPE
FRONT
Standard relative position type FRONT.static RelativePosition.TYPE
REAR
Standard relative position type BACK.static RelativePosition.TYPE
REFERENCE
Standard relative position type REFERENCE.static RelativePosition
REFERENCE_POSITION
The reference position (always 0, 0, 0). -
Constructor Summary
Constructors Constructor Description RelativePosition(Length dx, Length dy, Length dz, RelativePosition.TYPE type)
RelativePosition(RelativePosition p)
-
Method Summary
-
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. -
CENTER_GRAVITY
Center of gravity. -
REFERENCE_POSITION
The reference position (always 0, 0, 0).
-
-
Constructor Details
-
RelativePosition
- Parameters:
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.).
-
RelativePosition
- Parameters:
p
- RelativePosition; a relative position to make a deep copy of.
-
-
Method Details
-
getDx
- Returns:
- dx.
-
getDy
- Returns:
- dy.
-
getDz
- Returns:
- dz.
-
getType
- Returns:
- type.
-
toString
public final java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
calcHashCode
public final int calcHashCode()Calculate the hash code once.- Returns:
- the hash code.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-