generatePositionAndOrientationRelativeToCenteredTarget method
- Coordinates targetCoords,
- Point3d targetHeadingPitchRollDeg,
- Point3d cameraHeadingPitchDegDistanceMeters
Generate a position and orientation relative to, and oriented toward/centered on, a target position which is relative to the focused sphere (orientation relative to target).
The target has the specified orientation where heading in degrees (0=N, 90=E, 180=S, 270=W) is with respect to the surface of the focused sphere, pitch in degrees (0=the target forward vector is oriented to the center of the focused sphere, 90=the target forward vector is oriented toward the horizon), and roll in degrees about the target forward vector, positive to the left and negative to the right.
The generated orientation is toward, and with respect to, the target position, where heading in degrees (0=in the direction of the target heading, 90=looking at the target from its right/starboard side, 180=looking at the target from the front, 270=looking at the target from its left/port side).
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, 180=looking at the target from below). 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.
Parameters
- IN targetCoords Coordinates representing the desired latitude, longitude and altitude.
- IN targetHeadingPitchRollDeg Point3d representing the desired heading, pitch and roll.
- IN cameraHeadingPitchDegDistanceMeters Point3d desired heading pitch and distance for camera.
Returns
- GemError.success on success, otherwise see GemError for other values.
- The computed position and orientation.
Throws
- An exception if it fails.
Implementation
Pair<GemError, PositionOrientation>
generatePositionAndOrientationRelativeToCenteredTarget(
final Coordinates targetCoords,
final Point3d targetHeadingPitchRollDeg,
final Point3d cameraHeadingPitchDegDistanceMeters,
) {
final OperationResult resultString = objectMethod(
_pointerId,
'MapCamera',
'generatePositionAndOrientationRelativeToCenteredTarget',
args: <String, Object>{
'coordinates': targetCoords,
'tuple3D1': targetHeadingPitchRollDeg,
'tuple3D2': cameraHeadingPitchDegDistanceMeters,
},
);
return Pair<GemError, PositionOrientation>(
GemErrorExtension.fromCode(resultString['result']['errorCode']),
PositionOrientation(
position: Point3d.fromJson(resultString['result']['tuple3D']),
orientation: Point4d.fromJson(resultString['result']['tuple4D']),
),
);
}