generatePositionAndOrientationRelativeToTarget method

Pair<GemError, PositionOrientation> generatePositionAndOrientationRelativeToTarget(
  1. Coordinates targetCoords,
  2. Point3d targetHeadingPitchRollDeg,
  3. Point3d cameraHeadingPitchDegDistanceMeters,
  4. Point3d cameraHeadingPitchRollDeg,
)

Generate 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.

See generatePositionAndOrientationRelativeToCenteredTarget.

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.
  • IN cameraHeadingPitchRollDeg Point3d desired heading pitch and roll for camera.

Returns

Throws

  • An exception if it fails.

Implementation

Pair<GemError, PositionOrientation>
    generatePositionAndOrientationRelativeToTarget(
  final Coordinates targetCoords,
  final Point3d targetHeadingPitchRollDeg,
  final Point3d cameraHeadingPitchDegDistanceMeters,
  final Point3d cameraHeadingPitchRollDeg,
) {
  final OperationResult resultString = objectMethod(
    _pointerId,
    'MapCamera',
    'generatePositionAndOrientationRelativeToTarget',
    args: <String, Object>{
      'coordinates': targetCoords,
      'tuple3D1': targetHeadingPitchRollDeg,
      'tuple3D2': cameraHeadingPitchDegDistanceMeters,
      'tuple3D3': cameraHeadingPitchRollDeg,
    },
  );

  return Pair<GemError, PositionOrientation>(
    GemErrorExtension.fromCode(resultString['result']['errorCode']),
    PositionOrientation(
      position: Point3d.fromJson(resultString['result']['tuple3D']),
      orientation: Point4d.fromJson(resultString['result']['tuple4D']),
    ),
  );
}