cesium-native 0.47.0
Loading...
Searching...
No Matches
CesiumGeometry::Transforms Struct Referencefinal

Coordinate system matrix constructions helpers. More...

#include <CesiumGeometry/Transforms.h>

Static Public Member Functions

static glm::dmat4 createTranslationRotationScaleMatrix (const glm::dvec3 &translation, const glm::dquat &rotation, const glm::dvec3 &scale)
 Creates a translation-rotation-scale matrix, equivalent to translation * rotation * scale. So if a vector is multiplied with the resulting matrix, it will be first scaled, then rotated, then translated.
 
static void computeTranslationRotationScaleFromMatrix (const glm::dmat4 &matrix, glm::dvec3 *pTranslation, glm::dquat *pRotation, glm::dvec3 *pScale)
 Decomposes a matrix into translation, rotation, and scale components. This is the reverse of createTranslationRotationScaleMatrix.
 
static const glm::dmat4 & getUpAxisTransform (CesiumGeometry::Axis from, CesiumGeometry::Axis to)
 Gets a transform that converts from one up axis to another.
 
static glm::dmat4 createViewMatrix (const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up)
 Create a view matrix.
 
static glm::dmat4 createPerspectiveMatrix (double fovx, double fovy, double zNear, double zFar)
 Compute a Vulkan-style perspective projection matrix with reversed Z.
 
static glm::dmat4 createPerspectiveMatrix (double left, double right, double bottom, double top, double zNear, double zFar)
 Compute a Vulkan-style perspective projection matrix with reversed Z.
 
static glm::dmat4 createOrthographicMatrix (double left, double right, double bottom, double top, double zNear, double zFar)
 Compute a Vulkan-style orthographic projection matrix with reversed Z.
 

Static Public Attributes

static const glm::dmat4 Y_UP_TO_Z_UP
 A matrix to convert from y-up to z-up orientation, by rotating about PI/2 around the x-axis.
 
static const glm::dmat4 Z_UP_TO_Y_UP
 A matrix to convert from z-up to y-up orientation, by rotating about -PI/2 around the x-axis.
 
static const glm::dmat4 X_UP_TO_Z_UP
 A matrix to convert from x-up to z-up orientation, by rotating about -PI/2 around the y-axis.
 
static const glm::dmat4 Z_UP_TO_X_UP
 A matrix to convert from z-up to x-up orientation, by rotating about PI/2 around the y-axis.
 
static const glm::dmat4 X_UP_TO_Y_UP
 A matrix to convert from x-up to y-up orientation, by rotating about PI/2 around the z-axis.
 
static const glm::dmat4 Y_UP_TO_X_UP
 A matrix to convert from y-up to x-up orientation, by rotating about -PI/2 around the z-axis.
 

Detailed Description

Coordinate system matrix constructions helpers.

Definition at line 13 of file Transforms.h.

Member Function Documentation

◆ computeTranslationRotationScaleFromMatrix()

static void CesiumGeometry::Transforms::computeTranslationRotationScaleFromMatrix ( const glm::dmat4 & matrix,
glm::dvec3 * pTranslation,
glm::dquat * pRotation,
glm::dvec3 * pScale )
static

Decomposes a matrix into translation, rotation, and scale components. This is the reverse of createTranslationRotationScaleMatrix.

The scale may be negative (i.e. when switching from a right-handed to a left-handed system), but skew and other funny business will result in undefined behavior.

Parameters
matrixThe matrix to decompose.
pTranslationA pointer to the vector in which to store the translation, or nullptr if the translation is not needed.
pRotationA pointer to the quaternion in which to store the rotation, or nullptr if the rotation is not needed.
pScaleA pointer to the vector in which to store the scale, or nullptr if the scale is not needed.

◆ createOrthographicMatrix()

static glm::dmat4 CesiumGeometry::Transforms::createOrthographicMatrix ( double left,
double right,
double bottom,
double top,
double zNear,
double zFar )
static

Compute a Vulkan-style orthographic projection matrix with reversed Z.

"Vulkan-style", as return by this function and others, uses the following conventions:

  • X maps from -1 to 1 left to right
  • Y maps from 1 to -1 bottom to top
  • Z maps from 1 to 0 near to far (known as "reverse Z")
Parameters
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
zNeardistance of near plane
zFardistance of far plane. This can be infinite

◆ createPerspectiveMatrix() [1/2]

static glm::dmat4 CesiumGeometry::Transforms::createPerspectiveMatrix ( double fovx,
double fovy,
double zNear,
double zFar )
static

Compute a Vulkan-style perspective projection matrix with reversed Z.

"Vulkan-style", as return by this function and others, uses the following conventions:

  • X maps from -1 to 1 left to right
  • Y maps from 1 to -1 bottom to top
  • Z maps from 1 to 0 near to far (known as "reverse Z")
Parameters
fovxhorizontal field of view in radians
fovyvertical field of view in radians
zNeardistance to near plane
zFardistance to far plane

◆ createPerspectiveMatrix() [2/2]

static glm::dmat4 CesiumGeometry::Transforms::createPerspectiveMatrix ( double left,
double right,
double bottom,
double top,
double zNear,
double zFar )
static

Compute a Vulkan-style perspective projection matrix with reversed Z.

"Vulkan-style", as return by this function and others, uses the following conventions:

  • X maps from -1 to 1 left to right
  • Y maps from 1 to -1 bottom to top
  • Z maps from 1 to 0 near to far (known as "reverse Z")
Parameters
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
zNeardistance of near plane
zFardistance of far plane. This can be infinite

◆ createTranslationRotationScaleMatrix()

static glm::dmat4 CesiumGeometry::Transforms::createTranslationRotationScaleMatrix ( const glm::dvec3 & translation,
const glm::dquat & rotation,
const glm::dvec3 & scale )
static

Creates a translation-rotation-scale matrix, equivalent to translation * rotation * scale. So if a vector is multiplied with the resulting matrix, it will be first scaled, then rotated, then translated.

Parameters
translationThe translation.
rotationThe rotation.
scaleThe scale.

◆ createViewMatrix()

static glm::dmat4 CesiumGeometry::Transforms::createViewMatrix ( const glm::dvec3 & position,
const glm::dvec3 & direction,
const glm::dvec3 & up )
static

Create a view matrix.

This is similar to glm::lookAt(), but uses the pose of the viewer to create the view matrix. The view matrix is the inverse of the pose matrix.

Parameters
positionposition of the eye
directionview vector i.e., -z axis of the viewer's pose.
upup vector of viewer i.e., y axis of the viewer's pose.
Returns
The view matrix.

◆ getUpAxisTransform()

static const glm::dmat4 & CesiumGeometry::Transforms::getUpAxisTransform ( CesiumGeometry::Axis from,
CesiumGeometry::Axis to )
static

Gets a transform that converts from one up axis to another.

Parameters
fromThe up axis to convert from.
toThe up axis to convert to.
Returns
The up axis transform.

Member Data Documentation

◆ X_UP_TO_Y_UP

const glm::dmat4 CesiumGeometry::Transforms::X_UP_TO_Y_UP
static

A matrix to convert from x-up to y-up orientation, by rotating about PI/2 around the z-axis.

Definition at line 43 of file Transforms.h.

◆ X_UP_TO_Z_UP

const glm::dmat4 CesiumGeometry::Transforms::X_UP_TO_Z_UP
static

A matrix to convert from x-up to z-up orientation, by rotating about -PI/2 around the y-axis.

Definition at line 31 of file Transforms.h.

◆ Y_UP_TO_X_UP

const glm::dmat4 CesiumGeometry::Transforms::Y_UP_TO_X_UP
static

A matrix to convert from y-up to x-up orientation, by rotating about -PI/2 around the z-axis.

Definition at line 49 of file Transforms.h.

◆ Y_UP_TO_Z_UP

const glm::dmat4 CesiumGeometry::Transforms::Y_UP_TO_Z_UP
static

A matrix to convert from y-up to z-up orientation, by rotating about PI/2 around the x-axis.

Definition at line 19 of file Transforms.h.

◆ Z_UP_TO_X_UP

const glm::dmat4 CesiumGeometry::Transforms::Z_UP_TO_X_UP
static

A matrix to convert from z-up to x-up orientation, by rotating about PI/2 around the y-axis.

Definition at line 37 of file Transforms.h.

◆ Z_UP_TO_Y_UP

const glm::dmat4 CesiumGeometry::Transforms::Z_UP_TO_Y_UP
static

A matrix to convert from z-up to y-up orientation, by rotating about -PI/2 around the x-axis.

Definition at line 25 of file Transforms.h.


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