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

MapCamera.generatePositionAndOrientationRelativeToTarget() method

Generates a position and orientation relative to a target position, looking in any direction relative to the direction toward the target, all in the coordinate system of the focused target.

This function is the same as generatePositionAndOrientationRelativeToCenteredTarget, except the orientation can be in a direction other than centered on the target. The orientation is centered on the target when the 4th parameter, the camera/observer heading, pitch, roll = 0, 0, 0. A nonzero heading, in degrees, specifies a rotation about the observer/camera up axis, going through the observer/camera position. A nonzero pitch, in degrees, specifies a rotation about the observer/camera right axis, going through the observer/camera position. A nonzero roll, in degrees, specifies a rotation about the observer/camera forward vector.

Signature:

generatePositionAndOrientationRelativeToTarget(targetCoords: Coordinates, targetHeadingPitchRollDeg: Point3d, cameraHeadingPitchDegDistanceMeters: Point3d, cameraHeadingPitchRollDeg: Point3d): [GemError, PositionOrientation];

Parameters

Parameter

Type

Description

targetCoords

Coordinates

Coordinates representing the desired latitude, longitude and altitude.

targetHeadingPitchRollDeg

Point3d

Point3d representing the desired heading, pitch and roll.

cameraHeadingPitchDegDistanceMeters

Point3d

Point3d desired heading pitch and distance for camera.

cameraHeadingPitchRollDeg

Point3d

Point3d desired heading pitch and roll 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.