cesium-native 0.47.0
Loading...
Searching...
No Matches
Cesium3DTilesSelection::ViewState Class Referencefinal

The state of the view that is used during the traversal of a tileset. More...

#include <Cesium3DTilesSelection/ViewState.h>

Public Member Functions

 ViewState (const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up, const glm::dvec2 &viewportSize, double horizontalFieldOfView, double verticalFieldOfView, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
 Creates a new instance.
 
 ViewState (const glm::dmat4 &viewMatrix, const glm::dmat4 &projectionMatrix, const glm::dvec2 &viewportSize, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
 Creates a new instance of a view state with a general projection, including skewed perspective and orthographic projections.
 
 ViewState (const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up, const glm::dvec2 &viewportSize, double left, double right, double bottom, double top, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
 Creates a new instance of a view state with an orthographic projection.
 
const glm::dvec3 & getPosition () const noexcept
 Gets the position of the camera in Earth-centered, Earth-fixed coordinates.
 
const glm::dvec3 & getDirection () const noexcept
 Gets the look direction of the camera in Earth-centered, Earth-fixed coordinates.
 
glm::dvec3 getUp () const noexcept
 Gets the up direction of the camera in Earth-centered, Earth-fixed coordinates.
 
const std::optional< CesiumGeospatial::Cartographic > & getPositionCartographic () const noexcept
 Gets the position of the camera as a longitude / latitude / height.
 
const glm::dvec2 & getViewportSize () const noexcept
 Gets the size of the viewport in pixels.
 
double getHorizontalFieldOfView () const noexcept
 Gets the horizontal field-of-view angle in radians. This is only valid for a symmetric perspective projection.
 
double getVerticalFieldOfView () const noexcept
 Gets the vertical field-of-view angle in radians. This is only valid for a symmetric perspective projection.
 
const glm::dmat4 & getViewMatrix () const noexcept
 Gets the view matrix for the ViewState.
 
const glm::dmat4 & getProjectionMatrix () const noexcept
 Gets the projection matrix for the ViewState.
 
bool isBoundingVolumeVisible (const BoundingVolume &boundingVolume) const noexcept
 Returns whether the given BoundingVolume is visible for this camera.
 
double computeDistanceSquaredToBoundingVolume (const BoundingVolume &boundingVolume) const noexcept
 Computes the squared distance to the given BoundingVolume.
 
double computeScreenSpaceError (double geometricError, double distance) const noexcept
 Computes the screen space error from a given geometric error.
 

Static Public Member Functions

static ViewState create (const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up, const glm::dvec2 &viewportSize, double horizontalFieldOfView, double verticalFieldOfView, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
 Creates a new instance of a view state with a symmetric perspective projection.
 

Detailed Description

The state of the view that is used during the traversal of a tileset.

An instance of a view state can be created with the create function.

Definition at line 25 of file ViewState.h.

Constructor & Destructor Documentation

◆ ViewState() [1/3]

Cesium3DTilesSelection::ViewState::ViewState ( const glm::dvec3 & position,
const glm::dvec3 & direction,
const glm::dvec3 & up,
const glm::dvec2 & viewportSize,
double horizontalFieldOfView,
double verticalFieldOfView,
const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84 )

Creates a new instance.

Parameters
positionThe position of the eye point of the camera.
directionThe view direction vector of the camera.
upThe up vector of the camera.
viewportSizeThe size of the viewport, in pixels.
horizontalFieldOfViewThe horizontal field-of-view (opening) angle of the camera, in radians.
verticalFieldOfViewThe vertical field-of-view (opening) angle of the camera, in radians.
ellipsoidThe ellipsoid that will be used to compute the cartographic position from the cartesian position. Default value: CesiumGeospatial::Ellipsoid::WGS84.

◆ ViewState() [2/3]

Cesium3DTilesSelection::ViewState::ViewState ( const glm::dmat4 & viewMatrix,
const glm::dmat4 & projectionMatrix,
const glm::dvec2 & viewportSize,
const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84 )

Creates a new instance of a view state with a general projection, including skewed perspective and orthographic projections.

Parameters
viewMatrixThe view's view matrix i.e., the inverse of its pose
projectionMatrixsee e.g. CesiumGeometry::Transforms::createPerspectiveMatrix
viewportSizeThe size of the viewport, in pixels.
ellipsoidThe ellipsoid that will be used to compute the cartographic position from the cartesian position. Default value: CesiumGeospatial::Ellipsoid::WGS84.

◆ ViewState() [3/3]

Cesium3DTilesSelection::ViewState::ViewState ( const glm::dvec3 & position,
const glm::dvec3 & direction,
const glm::dvec3 & up,
const glm::dvec2 & viewportSize,
double left,
double right,
double bottom,
double top,
const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84 )

Creates a new instance of a view state with an orthographic projection.

Parameters
positionThe position of the eye point of the camera.
directionThe view direction vector of the camera.
upThe up vector of the camera.
viewportSizeThe size of the viewport, in pixels.
leftleft distance of near plane edge from center
rightright distance of near plane edge
bottombottom distance of near plane edge
toptop distance of near plane edge
ellipsoidThe ellipsoid that will be used to compute the cartographic position from the cartesian position. Default value: CesiumGeospatial::Ellipsoid::WGS84.

Member Function Documentation

◆ computeDistanceSquaredToBoundingVolume()

double Cesium3DTilesSelection::ViewState::computeDistanceSquaredToBoundingVolume ( const BoundingVolume & boundingVolume) const
noexcept

Computes the squared distance to the given BoundingVolume.

Computes the squared euclidean distance from the position of this camera to the closest point of the given bounding volume.

Parameters
boundingVolumeThe bounding volume
Returns
The squared distance

◆ computeScreenSpaceError()

double Cesium3DTilesSelection::ViewState::computeScreenSpaceError ( double geometricError,
double distance ) const
noexcept

Computes the screen space error from a given geometric error.

Computes the screen space error (SSE) that results from the given geometric error, when it is viewed with this camera from the given distance.

The given distance will be clamped to a small positive value if it is negative or too close to zero.

Parameters
geometricErrorThe geometric error
distanceThe viewing distance
Returns
The screen space error

◆ create()

static ViewState Cesium3DTilesSelection::ViewState::create ( const glm::dvec3 & position,
const glm::dvec3 & direction,
const glm::dvec3 & up,
const glm::dvec2 & viewportSize,
double horizontalFieldOfView,
double verticalFieldOfView,
const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84 )
static

Creates a new instance of a view state with a symmetric perspective projection.

Deprecated
Use ViewState::ViewState instead.

◆ getDirection()

const glm::dvec3 & Cesium3DTilesSelection::ViewState::getDirection ( ) const
inlinenoexcept

Gets the look direction of the camera in Earth-centered, Earth-fixed coordinates.

Definition at line 124 of file ViewState.h.

◆ getPosition()

const glm::dvec3 & Cesium3DTilesSelection::ViewState::getPosition ( ) const
inlinenoexcept

Gets the position of the camera in Earth-centered, Earth-fixed coordinates.

Definition at line 118 of file ViewState.h.

◆ getPositionCartographic()

const std::optional< CesiumGeospatial::Cartographic > & Cesium3DTilesSelection::ViewState::getPositionCartographic ( ) const
inlinenoexcept

Gets the position of the camera as a longitude / latitude / height.

The result may be std::nullopt if the Cartesian position is very near the center of the Ellipsoid.

Definition at line 144 of file ViewState.h.

◆ getProjectionMatrix()

const glm::dmat4 & Cesium3DTilesSelection::ViewState::getProjectionMatrix ( ) const
inlinenoexcept

Gets the projection matrix for the ViewState.

Definition at line 175 of file ViewState.h.

◆ getUp()

glm::dvec3 Cesium3DTilesSelection::ViewState::getUp ( ) const
inlinenoexcept

Gets the up direction of the camera in Earth-centered, Earth-fixed coordinates.

Definition at line 130 of file ViewState.h.

◆ getViewMatrix()

const glm::dmat4 & Cesium3DTilesSelection::ViewState::getViewMatrix ( ) const
inlinenoexcept

Gets the view matrix for the ViewState.

Definition at line 170 of file ViewState.h.

◆ getViewportSize()

const glm::dvec2 & Cesium3DTilesSelection::ViewState::getViewportSize ( ) const
inlinenoexcept

Gets the size of the viewport in pixels.

Definition at line 151 of file ViewState.h.

◆ isBoundingVolumeVisible()

bool Cesium3DTilesSelection::ViewState::isBoundingVolumeVisible ( const BoundingVolume & boundingVolume) const
noexcept

Returns whether the given BoundingVolume is visible for this camera.

Returns whether the given bounding volume is visible for this camera, meaning that the given volume is at least partially contained in the frustum of this camera.

Returns
Whether the bounding volume is visible

The documentation for this class was generated from the following file: