Package com.anylogic.engine
- java.lang.Object
- com.anylogic.engine.Point
- com.anylogic.engine.Position
- All Implemented Interfaces:
Locatable2D
,Serializable
,Cloneable
public class Position extends Point
Class representing Point structure three coordinates (x, y, z) with two
angles for orientation. Used in various utility methods in the AnyLogic
Engine and in some AnyLogic libraries.
For those utilities which operate in 2D space (x, y), the third (z) coordinate and vertical rotation are simply ignored
For those utilities which operate in 2D space (x, y), the third (z) coordinate and vertical rotation are simply ignored
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Field | Description |
---|---|---|
double | rotation |
The (horizontal) orientation, measured CW from right (east)
|
double | verticalRotation |
The vertical orientation, measured from horizontal-oriented (0) to the
ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is
negative
|
Constructor | Description |
---|---|
Position() |
Creates new position with zero (0, 0, 0) coordinates and zero rotation
angles (default orientation: horizontally to the right/east)
|
Position |
Creates new point with the given (x, y) coordinates and rotation.
|
Position |
Creates new position with the given coordinates and rotations.
|
Position |
Creates a position with the given coordinates.
|
Position | |
Position |
Creates a copy of the given position
|
Modifier and Type | Method | Description |
---|---|---|
Position | clone() | |
Position | clone |
Fills the given
output instance (if it is not null ) or
otherwise creates a copy of this object and returns it |
double | getRotation() |
Returns the horizontal orientation
|
double | getVerticalRotation() |
Returns the vertical orientation
|
Position | setLocation |
Sets the location and rotations of this Position to the same values as in the given
Position object.
|
Position | setPosition |
Sets the location and rotations of this Position to the given coordinates and rotations.
|
void | setRotation |
Sets the horizontal orientation
|
void | setVerticalRotation |
Sets the vertical orientation
|
String | toString() |
public double rotation
The (horizontal) orientation, measured CW from right (east)
public double verticalRotation
The vertical orientation, measured from horizontal-oriented (0) to the
ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is
negative
public Position()
Creates new position with zero (0, 0, 0) coordinates and zero rotation
angles (default orientation: horizontally to the right/east)
public Position(double x, double y, double z, double rotation, double verticalRotation)
Creates new position with the given coordinates and rotations.
- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinaterotation
- the (horizontal) orientation, measured CW from right (east)verticalRotation
- the vertical orientation, measured from horizontal-oriented (0) to the ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is negative
public Position(double x, double y, double rotation)
Creates new point with the given (x, y) coordinates and rotation. (z
coordinate and vertical rotation are set to zero)
- Parameters:
x
- the x coordinate of the Position In case of GIS environment this is the latitude of the Point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the Position In case of GIS environment this is the longitude of the Point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)rotation
- the (horizontal) orientation, measured CW from right (east)
public Position(Point p)
Creates a position with the given coordinates. Rotation angles are copied
from
p
in case when it is a Position instance- Parameters:
p
- the original point
public Position(Position p)
Creates a copy of the given position
- Parameters:
p
- the original point
public Position(Point p, double rotation, double verticalRotation)
public void setRotation(double rotation)
Sets the horizontal orientation
- Parameters:
rotation
- the (horizontal) orientation, measured CW from right (east)
public double getRotation()
Returns the horizontal orientation
- Returns:
- the (horizontal) orientation, measured CW from right (east)
public void setVerticalRotation(double verticalRotation)
Sets the vertical orientation
- Parameters:
verticalRotation
- the vertical orientation, measured from horizontal-oriented (0) to the ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is negative
public double getVerticalRotation()
Returns the vertical orientation
- Returns:
- the vertical orientation, measured from horizontal-oriented (0) to the ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is negative
public Position setLocation(Position p)
Sets the location and rotations of this Position to the same values as in the given
Position object.
- Parameters:
p
- the specified Position to which to set this Position- Returns:
- this Position object
public Position setPosition(double x, double y, double z, double rotation, double verticalRotation)
Sets the location and rotations of this Position to the given coordinates and rotations.
- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinaterotation
- the (horizontal) orientation, measured CW from right (east)verticalRotation
- the vertical orientation, measured from horizontal-oriented (0) to the ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is negative- Returns:
- this Position object
public Position clone()
public Position clone(Position out)
Fills the given
output
instance (if it is not null
) or
otherwise creates a copy of this object and returns it- Parameters:
out
- the Position object to write to (may benull
)- Returns:
- the given
output
object (if was notnull
) or new Position with coordinates and rotations set equal to this object.
public String toString()