SGPosition Class

In some cases, orientation information is also needed in order to describe the position of an object in the 3D world (e.g., in which direction the camera is looking). The SGPosition class contains both coordinate (x, y, height) and orientation (yaw, pitch, and roll) properties. In addition, the SGPosition can also describe a point of interest and the distance from which to observe the point of interest.

Constructor

Name

Description

Constructor

Initializes a new instance of the SGPosition class

Properties

Name

Description

x Property

The x coordinate, usually longitude.

y Property

The y coordinate, usually latitude.

height Property

The height of the coordinate.

heightType Property

The height type of the coordinate.

yaw Property

The direction in which the camera/object should be looking.

pitch Property

The tilt angle in which the camera/object should be looking.

roll Property

The roll angle of the object.

distance property

Distance from which the x, y and height properties are viewed.

Methods

Name

Description

move Method

Moves the coordinate a specific distance.

moveToward Method

Moves a coordinate the given distance toward another coordinate.

lerp Method

Moves a coordinate a given percentage toward another coordinate.

distanceTo Method

Measures the distance between two coordinates.

anglesTo Method

Measures the angles (yaw and pitch) between two coordinates.

aimTo Method

Returns an SGPosition object that represents the same position as the caller’s coordinates and the angles that are directed toward the given coordinates.

toAbsolute Method

Returns an SGPosition object that is converted to absolute height.

toRelative Method

Returns an SGPosition object that is converted to height relative to terrain.

changeHeightType Method

Converts the height of the caller to a new height type based on the caller’s x and y.

isEqual Method

Compare the properties values of this SGPosition object to another SGPosition object.