AnyLogic
Expand
Font size
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
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Modifier and TypeFieldDescription
doublerotation
The (horizontal) orientation, measured CW from right (east)
doubleverticalRotation
The vertical orientation, measured from horizontal-oriented (0) to the ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is negative

Fields inherited from class com.anylogic.engine.Point

x, y, z

Constructor Summary

ConstructorDescription
Position()
Creates new position with zero (0, 0, 0) coordinates and zero rotation angles (default orientation: horizontally to the right/east)
Position(double x, double y, double rotation)
Creates new point with the given (x, y) coordinates and rotation.
Position(double x, double y, double z, double rotation, double verticalRotation)
Creates new position with the given coordinates and rotations.
Position(Point p)
Creates a position with the given coordinates.
Position(Point p, double rotation, double verticalRotation) 
Position(Position p)
Creates a copy of the given position

Method Summary

Modifier and TypeMethodDescription
Positionclone() 
Positionclone(Position out)
Fills the given output instance (if it is not null) or otherwise creates a copy of this object and returns it
doublegetRotation()
Returns the horizontal orientation
doublegetVerticalRotation()
Returns the vertical orientation
PositionsetLocation(Position p)
Sets the location and rotations of this Position to the same values as in the given Position object.
PositionsetPosition(double x, double y, double z, double rotation, double verticalRotation)
Sets the location and rotations of this Position to the given coordinates and rotations.
voidsetRotation(double rotation)
Sets the horizontal orientation
voidsetVerticalRotation(double verticalRotation)
Sets the vertical orientation
StringtoString() 

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Field Details

rotation

public double rotation
The (horizontal) orientation, measured CW from right (east)

verticalRotation

public double verticalRotation
The vertical orientation, measured from horizontal-oriented (0) to the ground: "-Z" direction (ground) is positive, "+Z" direction (sky) is negative

Constructor Details

Position

public Position()
Creates new position with zero (0, 0, 0) coordinates and zero rotation angles (default orientation: horizontally to the right/east)

Position

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 coordinate
y - the y coordinate
z - the z coordinate
rotation - 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

Position

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)

Position

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

Position

public Position(Position p)
Creates a copy of the given position
Parameters:
p - the original point

Position

public Position(Point p,
 double rotation,
 double verticalRotation)

Method Details

setRotation

public void setRotation(double rotation)
Sets the horizontal orientation
Parameters:
rotation - the (horizontal) orientation, measured CW from right (east)

getRotation

public double getRotation()
Returns the horizontal orientation
Returns:
the (horizontal) orientation, measured CW from right (east)

setVerticalRotation

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

getVerticalRotation

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

setLocation

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

setPosition

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 coordinate
y - the y coordinate
z - the z coordinate
rotation - 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

clone

public Position clone()
Overrides:
clone in class Point

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 be null)
Returns:
the given output object (if was not null) or new Position with coordinates and rotations set equal to this object.

toString

public String toString()
Overrides:
toString in class Point