Altus Mapping Engine JavaScript API Reference - v2.0.ut.2153.g60764257e - Tuesday May 16, 2022 SDK Documentation | Builds | BA3 Home
AltusUnified::Camera Class Reference

A virtual camera that controls how the map is viewed. More...

Public Member Functions

GeographicPosition getLocationThatFitsCoordinates (VectorGeographicPosition2D coords, double horizontalBuffer, double verticalBuffer)
 Returns a position where the camera can be placed so that it can see all the locations in coords. More...
 
GeographicPosition getLocationThatFitsBoundingBox (BoundingBox bounds, double horizontalBuffer, double verticalBuffer)
 Returns a position where the camera can be placed so that it can see everything in a bounding box. More...
 
vec3d getRay (ScreenSpacePercentagePoint p)
 Returns the 3D vector, in world coordinates, for an imaginary ray that passes from the center of the camera through a point on the screen. You can intersect the Earth with this ray to determine what is behind a screen point (however, see Camera::GetGeographicPosition2D for a faster method). More...
 
ScreenSpacePercentagePoint getScreenSpacePercentagePoint (GeographicPosition geographicPosition)
 Returns the screen space position of a point on the spherical Earth. Take special note that the result of this function is only sensible if the geographic position is on screen. If it is behind the camera, the result will be misleading. If 3D terrain is used, the result will not be accurate. More...
 
GeographicPosition2D getGeographicPosition2D (ScreenSpacePercentagePoint p)
 Returns the location on the spherical Earth behind a screen point. If 3D terrain is used, the result will not be accurate. More...
 
void setVerticalFov (float verticalFovInRadiansWhenPortrait, float verticalFovInRadiansWhenLandscape)
 Sets the vertical field of view (the angle in radians between the top and bottom of the screen). More...
 
double verticalFov ()
 Returns the current vertical field of view. See SetVerticalFov. More...
 
double aspectHorizontalOverVertical ()
 Returns the aspect ratio of the screen. More...
 
float getScreenSpaceRotationForGeographicPosition (GeographicPosition2D geographicPosition, float headingInRadians)
 Calculate the screen space orientation in radians of an object on the Earth with a particular heading (yaw). Use this if you would like to create a screen space marker that matches the orientation of a 3D object. More...
 
float getScreenSpaceRotationForPoint (ScreenSpacePercentagePoint p, float headingInRadians)
 Calculate the screen space orientation in radians of an object on the spherical Earth at a particular point on the screen at a with a particular heading (yaw). If 3D terrain is used, the result will not be accurate. More...
 

Public Attributes

TransformPtr transform
 The camera's transform. Use this to control the position and orientation of the camera. More...
 

Detailed Description

A virtual camera that controls how the map is viewed.

Member Function Documentation

double AltusUnified::Camera::aspectHorizontalOverVertical ( )

Returns the aspect ratio of the screen.

GeographicPosition2D AltusUnified::Camera::getGeographicPosition2D ( ScreenSpacePercentagePoint  p)

Returns the location on the spherical Earth behind a screen point. If 3D terrain is used, the result will not be accurate.

Parameters
pThe screen point.
GeographicPosition AltusUnified::Camera::getLocationThatFitsBoundingBox ( BoundingBox  bounds,
double  horizontalBuffer,
double  verticalBuffer 
)

Returns a position where the camera can be placed so that it can see everything in a bounding box.

Parameters
boundsThe bounding box the camera should see.
horizontalBufferThe verticalBuffer screen space size, in points, at the left and right of the screen where the bounding box should not lie.
GeographicPosition AltusUnified::Camera::getLocationThatFitsCoordinates ( VectorGeographicPosition2D  coords,
double  horizontalBuffer,
double  verticalBuffer 
)

Returns a position where the camera can be placed so that it can see all the locations in coords.

Parameters
coordsThe list of locations the camera should see.
horizontalBufferThe verticalBuffer screen space size, in points, at the left and right of the screen where the points should not lie.
vec3d AltusUnified::Camera::getRay ( ScreenSpacePercentagePoint  p)

Returns the 3D vector, in world coordinates, for an imaginary ray that passes from the center of the camera through a point on the screen. You can intersect the Earth with this ray to determine what is behind a screen point (however, see Camera::GetGeographicPosition2D for a faster method).

Parameters
pThe point on the screen the ray will pass through.
ScreenSpacePercentagePoint AltusUnified::Camera::getScreenSpacePercentagePoint ( GeographicPosition  geographicPosition)

Returns the screen space position of a point on the spherical Earth. Take special note that the result of this function is only sensible if the geographic position is on screen. If it is behind the camera, the result will be misleading. If 3D terrain is used, the result will not be accurate.

Parameters
geographicPositionThe location.
float AltusUnified::Camera::getScreenSpaceRotationForGeographicPosition ( GeographicPosition2D  geographicPosition,
float  headingInRadians 
)

Calculate the screen space orientation in radians of an object on the Earth with a particular heading (yaw). Use this if you would like to create a screen space marker that matches the orientation of a 3D object.

Parameters
geographicPositionThe location of the object.
headingInRadiansThe heading (yaw) of the object, in radians.
float AltusUnified::Camera::getScreenSpaceRotationForPoint ( ScreenSpacePercentagePoint  p,
float  headingInRadians 
)

Calculate the screen space orientation in radians of an object on the spherical Earth at a particular point on the screen at a with a particular heading (yaw). If 3D terrain is used, the result will not be accurate.

Parameters
pThe screen space position where the orientation should be calculated.
headingInRadiansThe heading (yaw) of the object, in radians.
void AltusUnified::Camera::setVerticalFov ( float  verticalFovInRadiansWhenPortrait,
float  verticalFovInRadiansWhenLandscape 
)

Sets the vertical field of view (the angle in radians between the top and bottom of the screen).

Parameters
verticalFovInRadiansWhenPortraitThe field of view when the screen is vertically aligned (especially useful for mobile devices).
verticalFovInRadiansWhenLandscapeThe field of view when the screen is horizontally aligned (especially useful for mobile devices).
double AltusUnified::Camera::verticalFov ( )

Returns the current vertical field of view. See SetVerticalFov.

Member Data Documentation

TransformPtr AltusUnified::Camera::transform

The camera's transform. Use this to control the position and orientation of the camera.