math Namespace
Definition
Namespaces Index
| namespace | concepts |
| namespace | transform |
Classes Index
| struct | aabb<T> |
|
Axis-Aligned Bounding Box for spatial culling and collision detection. More... | |
| struct | mat4<T> |
|
Represents a 4x4 matrix, stored in column-major order. More... | |
| struct | vec2<T> |
|
Represents a 2-dimensional vector of the generic type <T>. More... | |
| struct | vec3<T> |
|
Represents a 3-dimensional vector of the generic type <T>. More... | |
| struct | vec4<T> |
|
Represents a 4-dimensional vector of the generic type <T>. More... | |
Typedefs Index
template <typename T> | |
| using | FloatingPointType = std::conditional_t< std::is_floating_point_v< T >, T, double > |
|
Type trait that promotes integral types to double, while preserving floating-point types. More... | |
| using | aabbf = aabb< float > |
|
Single-precision floating-point AABB. More... | |
| using | aabbi = aabb< int > |
|
Integer AABB. More... | |
| using | aabbui = aabb< unsigned int > |
|
Unsigned Integer AABB. More... | |
| using | aabbd = aabb< double > |
|
Double-precision floating-point AABB. More... | |
| using | mat4f = mat4< float > |
|
Type alias for a 4x4 float matrix. More... | |
| using | mat4d = mat4< double > |
|
Type alias for a 4x4 double matrix. More... | |
| using | mat4i = mat4< int > |
|
Type alias for a 4x4 integer matrix. More... | |
| using | vec2f = vec2< float > |
| using | vec2d = vec2< double > |
| using | vec2i = vec2< int > |
| using | vec2ui = vec2< unsigned int > |
| using | vec3f = vec3< float > |
|
Single-precision floating-point 3D vector. More... | |
| using | vec3i = vec3< int > |
|
Integer 3D vector. More... | |
| using | vec3d = vec3< double > |
|
Double-precision floating-point 3D vector. More... | |
| using | vec4f = vec4< float > |
|
Single-precision floating-point 4D vector. More... | |
| using | vec4d = vec4< double > |
|
Double-precision floating-point 4D vector. More... | |
| using | vec4i = vec4< int > |
|
Integer 4D vector. More... | |
Enumerations Index
| enum class | TransformType : uint8_t { ... } |
|
Bitmask enum controlling which transform components a child node inherits from its parent. More... | |
Operators Index
| TransformType | operator| (TransformType a, TransformType b) |
|
Combines two Inherit flags using bitwise OR. More... | |
template <typename T> | |
| auto | operator+ (const helios::math::aabb< T > aabb, const helios::math::vec3< T > v) noexcept -> constexpr helios::math::aabb< T > |
|
Adds a translation vector to an AABB. More... | |
template <typename T> | |
| auto | operator* (const helios::math::aabb< T > &aabb, const helios::math::vec3< T > v) noexcept -> constexpr helios::math::aabb< T > |
|
Scales an AABB by a given vector. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator* (const vec2< T > &v, const T n) noexcept -> constexpr vec2< T > |
|
Multiplies a 2D vector by a scalar value. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator* (const vec3< T > &v, const T n) noexcept -> constexpr vec3< T > |
|
Multiplies a 3D vector by a scalar value. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator/ (const vec3< T > &v, T s) noexcept -> constexpr vec3< T > |
|
Divides a 3D vector by a scalar value. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator* (const T n, const vec3< T > &v) noexcept -> constexpr vec3< T > |
|
Multiplies a scalar value by a 3D vector. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator* (const vec3< T > &v1, const vec3< T > &v2) noexcept -> constexpr vec3< T > |
|
Multiplies two vectors componentwise. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator+ (const vec3< T > &v1, const vec3< T > &v2) noexcept -> constexpr vec3< T > |
|
Calculates the componentwise sum of the two vectors. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | operator- (const vec3< T > &v1, const vec3< T > &v2) noexcept -> constexpr vec3< T > |
|
Computes the difference between two vectors (vector subtraction). More... | |
Functions Index
| mat4f | perspective (float fovY, float aspect, float zNear, float zFar) noexcept |
|
Computes the 4x4 perspective projection matrix based on the specified field of view, aspect ratio, and near and far clipping planes. More... | |
| mat4f | ortho (const float left, const float right, const float bottom, const float top, const float zNear=0.1f, const float zFar=100.0f) noexcept |
|
Computes the 4x4 orthographic projection matrix. More... | |
| mat4f | lookAt (const vec3f &eye, const vec3f ¢er, const vec3f &up) noexcept |
|
Returns the 4x4 lookAt-matrix for transforming world coordinates to camera space. The method creates the camera coordinate system based on the parameters eye, i.e. the vantage point in world space, the camera's up direction and center, representing the point of interest. Note that the returned matrix is essentially a composition of a change of coordinates matrix P(C <- W) and a translation to the origin, i.e. the camera is sitting at the origin (0, 0, 0) looking down the negative z-axis, i.e. conceptually. More... | |
| mat4f | rotate (const mat4f &model, float radians, const vec3f &axis) noexcept |
|
Creates an affine rotation matrix R' = M * R by "baking" the rotation part into the model matrix. Any operation R' * v will make sure that v is rotated around the local origin, then transformed into world space. More... | |
| constexpr mat4f | translate (const mat4f &model, const vec3f &v) noexcept |
|
Creates an affine transformation matrix M' = M * T by "baking" the translation part into the model matrix. Any operation M' * v will make sure that v is translated in local space, then transformed into world space. More... | |
| constexpr mat4f | scale (const mat4f &model, const vec3f &v) noexcept |
|
Creates an affine transformation matrix S' = M * S by ""baking" the scaling part into the model matrix. Any operation S' * v will make sure that v is scaled in local space, then transformed into world space. More... | |
| constexpr mat4f | scale (const mat4f &model, const float scale_by) noexcept |
|
Creates an affine transformation matrix S' = M * S by "baking" the scaling part into the model matrix. Any operation S' * v will make sure that v is scaled in local space, then transformed into world space. More... | |
| bool | transformTypeMatch (TransformType mask, TransformType flag) |
|
Checks if a specific inheritance flag is set in a mask. More... | |
template <typename T> | |
| auto | overlap (const helios::math::aabb< T > a, const helios::math::aabb< T > b) noexcept -> constexpr helios::math::vec3< T > |
|
Computes the signed dimensions of the overlapping region between two axis-aligned bounding boxes (AABBs). More... | |
template <typename T> | |
| auto | overlapCenter (const helios::math::aabb< T > a, const helios::math::aabb< T > b) noexcept -> constexpr helios::math::vec3< T > |
|
Computes the center of intersection of the overlapping region between two axis-aligned bounding boxes (AABBs). More... | |
template <helios::math::concepts::IsNumeric T> | |
| const T * | value_ptr (const mat4< T > &m) noexcept |
|
Returns a const pointer to the first element of the matrix's components. More... | |
template <helios::math::concepts::IsNumeric T> | |
| T * | value_ptr (mat4< T > &m) noexcept |
|
Returns a pointer to the first element of the matrix's components. More... | |
template <helios::math::concepts::IsNumeric T> | |
| constexpr T | dot (const vec2< T > &v1, const vec2< T > &v2) noexcept |
|
Computes the dot product of two 2D vectors. More... | |
template <helios::math::concepts::IsNumeric T> | |
| auto | cross (const vec3< T > &v1, const vec3< T > &v2) noexcept -> constexpr vec3< T > |
|
Computes the cross product of two 3D vectors. More... | |
template <helios::math::concepts::IsNumeric T> | |
| constexpr T | dot (const vec3< T > &v1, const vec3< T > &v2) noexcept |
|
Computes the dot product of two 3D vectors. More... | |
template <helios::math::concepts::IsNumeric T> | |
| const T * | value_ptr (const vec4< T > &m) noexcept |
|
Returns a const pointer to the first element of the vector's components. More... | |
| constexpr float | radians (const float angle) noexcept |
|
Converts an angle from degrees to radians. More... | |
| constexpr float | degrees (const float radians) noexcept |
|
Converts an angle from radians to degrees. More... | |
Variables Index
| constexpr vec3f | X_AXISf {1.0f, 0.0f, 0.0f} |
|
Unit vector along the positive X-axis (1, 0, 0). More... | |
| constexpr vec3f | Y_AXISf {0.0f, 1.0f, 0.0f} |
|
Unit vector along the positive Y-axis (0, 1, 0). More... | |
| constexpr vec3f | Z_AXISf {0.0f, 0.0f, 1.0f} |
|
Unit vector along the positive Z-axis (0, 0, 1). More... | |
| constexpr float | EPSILON_LENGTH = 1e-6f |
|
A small epsilon value used for length-based comparisons. More... | |
Typedefs
aabbd
|
Double-precision floating-point AABB.
Definition at line 387 of file aabb.ixx.
aabbf
|
Single-precision floating-point AABB.
Definition at line 372 of file aabb.ixx.
aabbi
|
aabbui
|
Unsigned Integer AABB.
Definition at line 382 of file aabb.ixx.
FloatingPointType
|
Type trait that promotes integral types to double, while preserving floating-point types.
- Template Parameters
-
T the input type
Definition at line 18 of file FloatingPointTypeTrait.ixx.
mat4d
|
Type alias for a 4x4 double matrix.
Definition at line 541 of file mat4.ixx.
mat4f
|
Type alias for a 4x4 float matrix.
Definition at line 536 of file mat4.ixx.
mat4i
|
vec2d
|
Definition at line 218 of file vec2.ixx.
vec2f
|
Definition at line 217 of file vec2.ixx.
vec2i
|
vec2ui
|
Definition at line 220 of file vec2.ixx.
vec3d
|
Double-precision floating-point 3D vector.
Definition at line 464 of file vec3.ixx.
vec3f
|
Single-precision floating-point 3D vector.
Definition at line 454 of file vec3.ixx.
vec3i
|
vec4d
|
Double-precision floating-point 4D vector.
Definition at line 177 of file vec4.ixx.
vec4f
|
Single-precision floating-point 4D vector.
Definition at line 172 of file vec4.ixx.
vec4i
Enumerations
TransformType
| strong |
Bitmask enum controlling which transform components a child node inherits from its parent.
- Enumeration values
When a SceneNode is attached to a parent, its final world transform is computed by combining the parent's world transform with the child's local transform. The Inherit flags determine which components (Translation, Rotation, Scale) of the parent transform are applied to the child.
This enables flexible scene graph behaviors such as:
- A camera that follows an object's position but maintains its own orientation (TransformType::Translation)
- UI elements that inherit full transforms (TransformType::All)
- Objects that only inherit rotation for billboard effects (TransformType::Rotation)
Example usage:
Definition at line 41 of file TransformType.ixx.
Operators
operator-()
| constexpr noexcept |
Computes the difference between two vectors (vector subtraction).
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v1 The first vec3<T> vector.
v2 The second vec3<T> vector.
- Returns
A new vec3<T> instance representing the difference between v1 and v2.
operator*()
| constexpr noexcept |
Scales an AABB by a given vector.
This operator overload allows scaling of an axis-aligned bounding box (AABB) by multiplying its min and max points with the given vector.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
aabb The AABB to be scaled.
v The scaling vector, for which only positive values are allowed.
- Returns
A new AABB scaled by the given vector.
Definition at line 363 of file aabb.ixx.
References helios::math::aabb< T >::max and helios::math::aabb< T >::min.
operator*()
| constexpr noexcept |
Multiplies a 2D vector by a scalar value.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v The vec2<T> vector to be multiplied.
n The scalar vector to multiplay the vector by.
- Returns
a new vec2<T> instance representing the result of the scalar multiplication.
operator*()
| constexpr noexcept |
Multiplies a 3D vector by a scalar value.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v The vec3<T> vector to be multiplied.
n The scalar value to multiply the vector by.
- Returns
a new vec3<T> instance representing the result of the scalar multiplication.
operator*()
| constexpr noexcept |
Multiplies a scalar value by a 3D vector.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
n The scalar value to multiply the vector by.
v The vec3<T> vector to be multiplied.
- Returns
A new vec3<T> instance representing the result of the scalar multiplication.
operator*()
| constexpr noexcept |
Multiplies two vectors componentwise.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v1 The left-hand vec3<T> vector to be multiplied.
v2 The right-hand vec3<T> vector to be multiplied.
- Returns
A new vec3<T> instance representing the result of the componentwise multiplication of the two vectors.
operator/()
| constexpr noexcept |
Divides a 3D vector by a scalar value.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v The vec3<T> vector to be divided.
s The scalar divisor. Must not be zero.
- Returns
A new vec3<T> instance representing the result of the scalar division.
- Precondition
s != 0 (asserted in debug builds).
operator+()
| constexpr noexcept |
Adds a translation vector to an AABB.
This operator overload allows the addition of a translation vector to an axis-aligned bounding box (AABB), resulting in a new translated AABB.
- Template Parameters
-
T The numeric type of the vector components (e.g., float or double).
- Parameters
-
aabb The AABB to be translated.
v The translation vector to apply.
- Returns
A new AABB translated by the given vector.
Definition at line 345 of file aabb.ixx.
Reference helios::math::aabb< T >::translate.
operator+()
| constexpr noexcept |
Calculates the componentwise sum of the two vectors.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v1 The left-hand vec3<T> vector to be added.
v2 The right-hand vec3<T> vector to be added.
- Returns
A new vec3<T> instance representing the sum of the two vectors.
operator|()
| inline |
Combines two Inherit flags using bitwise OR.
- Parameters
-
a The first inheritance flag.
b The second inheritance flag.
- Returns
The combined inheritance mask.
Definition at line 83 of file TransformType.ixx.
Functions
cross()
| constexpr noexcept |
Computes the cross product of two 3D vectors.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v1 The first vec3<T> vector.
v2 The second vec3<T> vector.
- Returns
A new vec3<T> instance representing the cross product.
Definition at line 367 of file vec3.ixx.
Referenced by helios::math::mat4< T >::inverse and lookAt.
degrees()
dot()
| constexpr noexcept |
Computes the dot product of two 2D vectors.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v1 The first vec2<T> vector.
v2 The second vec2<T> vector.
- Returns
The dot product as a value of type T.
Definition at line 213 of file vec2.ixx.
Referenced by helios::math::mat4< T >::inverse and lookAt.
dot()
| constexpr noexcept |
Computes the dot product of two 3D vectors.
- Template Parameters
-
T The numeric type of the vector components.
- Parameters
-
v1 The first vec3<T> vector.
v2 The second vec3<T> vector.
- Returns
The dot product as a value of type T.
lookAt()
| inline noexcept |
Returns the 4x4 lookAt-matrix for transforming world coordinates to camera space. The method creates the camera coordinate system based on the parameters eye, i.e. the vantage point in world space, the camera's up direction and center, representing the point of interest. Note that the returned matrix is essentially a composition of a change of coordinates matrix P(C <- W) and a translation to the origin, i.e. the camera is sitting at the origin (0, 0, 0) looking down the negative z-axis, i.e. conceptually.
P(W<-C) * T(-eye)
The 4x4 matrix can then be used for computing the perspective projection for creating the clip space
clip = P * V * W * M
- Parameters
-
eye center up
- Returns
Definition at line 106 of file camera.ixx.
ortho()
| inline noexcept |
Computes the 4x4 orthographic projection matrix.
Creates a projection matrix that maps 3D coordinates to normalized device coordinates without perspective distortion. Parallel lines remain parallel, and object size does not change with distance from the camera.
Suitable for 2D rendering, UI elements, and technical visualizations.
- Parameters
-
left The left boundary of the view volume.
right The right boundary of the view volume.
bottom The bottom boundary of the view volume.
top The top boundary of the view volume.
zNear The distance to the near clipping plane (default: 0.1).
zFar The distance to the far clipping plane (default: 100.0).
- Returns
A 4x4 orthographic projection matrix.
- See Also
Definition at line 68 of file camera.ixx.
overlap()
| constexpr noexcept |
Computes the signed dimensions of the overlapping region between two axis-aligned bounding boxes (AABBs).
Given two AABBs, this function calculates the intersection bounds along each axis. The resulting vector represents the size (extents) of the intersection.
- Template Parameters
-
T The numeric type used for the vector components (e.g., float or double).
- Parameters
-
a The first AABB.
b The second AABB.
- Returns
A 3D vector representing the dimensions of the overlapping region between the AABBs. If no overlap exists, the resulting vector may contain non-positive values in one or more components.
Definition at line 282 of file aabb.ixx.
References helios::math::aabb< T >::max and helios::math::aabb< T >::min.
overlapCenter()
| constexpr noexcept |
Computes the center of intersection of the overlapping region between two axis-aligned bounding boxes (AABBs).
This function calculates the center of the intersection region of the two AABBs. If the AABBs do not overlap, the returned value represents the midpoint of the gap between them.
- Template Parameters
-
T The numeric type used for the vector components (e.g., float or double).
- Parameters
-
a The first AABB.
b The second AABB.
- Returns
A 3D vector representing the center point of the overlapping or gapping region between the AABBs.
Definition at line 314 of file aabb.ixx.
References helios::math::aabb< T >::max and helios::math::aabb< T >::min.
perspective()
Computes the 4x4 perspective projection matrix based on the specified field of view, aspect ratio, and near and far clipping planes.
This method returns a matrix suitable for projecting 3D points onto a 2D screen from the perspective of a camera. The perspective transformation maps 3D points inside the specified viewing frustum to normalized device coordinates, which are then clipped and transformed to screen space.
- Parameters
-
fovY Field of view in the Y direction, specified in radians.
aspect The aspect ratio of the view, defined as width divided by height.
zNear The distance to the near clipping plane. Must be greater than zero.
zFar The distance to the far clipping plane. Must be greater than zNear.
- Returns
A 4x4 matrix representing the perspective projection transformation.
Definition at line 35 of file camera.ixx.
radians()
rotate()
Creates an affine rotation matrix R' = M * R by "baking" the rotation part into the model matrix. Any operation R' * v will make sure that v is rotated around the local origin, then transformed into world space.
- Parameters
-
model radians axis
- Returns
Definition at line 62 of file model.ixx.
References helios::math::transform::make_rodrigues_rotation_matrix and radians.
scale()
Creates an affine transformation matrix S' = M * S by ""baking" the scaling part into the model matrix. Any operation S' * v will make sure that v is scaled in local space, then transformed into world space.
- Parameters
-
model v
- Returns
scale()
Creates an affine transformation matrix S' = M * S by "baking" the scaling part into the model matrix. Any operation S' * v will make sure that v is scaled in local space, then transformed into world space.
- Parameters
-
model scale_by
- Returns
transformTypeMatch()
| inline |
Checks if a specific inheritance flag is set in a mask.
- Parameters
-
mask The inheritance mask to check against.
flag The specific flag to test for.
- Returns
true if the flag is present in the mask, false otherwise.
Example usage:
Definition at line 107 of file TransformType.ixx.
Referenced by helios::math::mat4< T >::decompose.
translate()
Creates an affine transformation matrix M' = M * T by "baking" the translation part into the model matrix. Any operation M' * v will make sure that v is translated in local space, then transformed into world space.
- Parameters
-
model v
- Returns
Definition at line 82 of file model.ixx.
value_ptr()
| noexcept |
Returns a const pointer to the first element of the matrix's components.
Useful for APIs that expect a pointer to matrix data, like OpenGL.
- Template Parameters
-
T The numeric type of the matrix components.
- Parameters
-
m A reference to the mat4<T> matrix.
- Returns
A const pointer to the element at [0, 0].
Definition at line 512 of file mat4.ixx.
Referenced by helios::math::mat4< T >::operator== and helios::math::mat4< T >::same.
value_ptr()
| noexcept |
Returns a pointer to the first element of the matrix's components.
Useful for APIs that expect a pointer to matrix data, like OpenGL.
- Template Parameters
-
T The numeric type of the matrix components.
- Parameters
-
m A reference to the mat4<T> matrix.
- Returns
A pointer to the element at [0, 0].
value_ptr()
| noexcept |
Returns a const pointer to the first element of the vector's components.
Useful for APIs that expect a pointer to vector data, like OpenGL
- Parameters
-
m A reference to the vec4<T> vector.
- Template Parameters
-
T The numeric type of the vector components.
Variables
EPSILON_LENGTH
A small epsilon value used for length-based comparisons.
This constant represents the minimum threshold value for length comparisons to account for numerical precision errors in floating-point calculations. It is often used to avoid treating very small values as significant, effectively filtering out noise in computations that involve vector-lengths.
Definition at line 22 of file utils.ixx.
Referenced by helios::math::vec2< T >::isNormalized and helios::math::vec3< T >::isNormalized.
X_AXISf
| constexpr |
Y_AXISf
| constexpr |
Z_AXISf
| constexpr |
The documentation for this namespace was generated from the following files:
- FloatingPointTypeTrait.ixx
- camera.ixx
- model.ixx
- TransformType.ixx
- aabb.ixx
- mat4.ixx
- vec2.ixx
- vec3.ixx
- vec4.ixx
- utils.ixx
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.