Home > @magiclane/maps-sdk > MapCamera > generatePositionAndOrientationTargetCentered

MapCamera.generatePositionAndOrientationTargetCentered() method

Generates a position and orientation relative to, and oriented toward/centered on, a target position which is relative to the focused sphere (orientation relative to sphere).

The specified target position is at lon,lat in degrees, with respect to surface of the focused sphere, altitude in meters above sphere (sea level).

The target position does not have an orientation, so it can be considered a point.

The generated orientation is toward the target position, where heading in degrees (0=N, 90=E, 180=S, 270=W) is with respect to the surface of the focused sphere, so heading 0 is looking at the target toward the north, from a position south of the target (the generated position is at 180 degrees as seen from the target).

Pitch in degrees (0=looking toward the target center from above the target, 90=looking at the target center from the horizontal plane/equator of the target, which is the plane containing the target forward and right vectors). The roll is always 0, so the horizon is level.

The generated position is at the specified distance in meters from the target center.

The camera position and orientation are unchanged. The camera or any other object can then be set at the resulting position and with the resulting orientation.

Signature:

generatePositionAndOrientationTargetCentered(targetCoords: Coordinates, cameraHeadingPitchDegDistanceMeters: Point3d): [GemError, PositionOrientation];

Parameters

Parameter

Type

Description

targetCoords

Coordinates

Coordinates representing the desired latitude, longitude and altitude.

cameraHeadingPitchDegDistanceMeters

Point3d

Point3d desired heading pitch and distance for camera.

Returns:

[GemError, PositionOrientation]

Tuple containing GemError.success on success (otherwise see GemError for other values) and the computed position and orientation.

Exceptions

An exception if it fails.