#include <MathHelpers.hpp>
Static helper functions for math.
◆ buildRotationMatrix()
glm::mat4x4 ne::MathHelpers::buildRotationMatrix |
( |
const glm::vec3 & |
rotation | ) |
|
|
inlinestatic |
Builds a rotation matrix in the engine specific way.
- Parameters
-
rotation | Rotation in degrees where X is roll, Y is pitch and Z is yaw. |
- Returns
- Rotation matrix.
◆ calculateReciprocalVector()
glm::vec3 ne::MathHelpers::calculateReciprocalVector |
( |
const glm::vec3 & |
vector | ) |
|
|
inlinestatic |
Calculates 1 / vector while checking for zero division.
- Parameters
-
- Returns
- vector 1 / input vector.
◆ convertCartesianCoordinatesToSpherical()
void ne::MathHelpers::convertCartesianCoordinatesToSpherical |
( |
const glm::vec3 & |
location, |
|
|
float & |
radius, |
|
|
float & |
theta, |
|
|
float & |
phi |
|
) |
| |
|
inlinestatic |
Converts coordinates from the Cartesian coordinate system to spherical coordinate system.
- Parameters
-
location | Location in Cartesian coordinate system. |
radius | Calculated radius in spherical coordinate system. |
theta | Calculated theta in spherical coordinate system (in degrees). |
phi | Calculated phi in spherical coordinate system (in degrees). |
◆ convertNormalizedDirectionToRollPitchYaw()
glm::vec3 ne::MathHelpers::convertNormalizedDirectionToRollPitchYaw |
( |
const glm::vec3 & |
direction | ) |
|
|
inlinestatic |
Converts a direction to rotation angles.
- Warning
- Expects the specified direction to be normalized.
- Parameters
-
direction | Normalized direction to convert. |
- Returns
- Roll (as X), pitch (as Y) and yaw (as Z) in degrees.
◆ convertRollPitchYawToDirection()
glm::vec3 ne::MathHelpers::convertRollPitchYawToDirection |
( |
const glm::vec3 & |
rotation | ) |
|
|
inlinestatic |
Converts rotation angles to a direction.
- Parameters
-
rotation | Rotation roll (as X), pitch (as Y) and yaw (as Z) in degrees. |
- Returns
- Unit direction vector.
◆ convertSphericalToCartesianCoordinates()
glm::vec3 ne::MathHelpers::convertSphericalToCartesianCoordinates |
( |
float |
radius, |
|
|
float |
theta, |
|
|
float |
phi |
|
) |
| |
|
inlinestatic |
Converts coordinates from the spherical coordinate system to the Cartesian coordinate system.
- Parameters
-
radius | Radial distance. |
theta | Azimuthal angle (in degrees). |
phi | Polar angle (in degrees). |
- Returns
- Coordinates in Cartesian coordinate system.
◆ normalizeSafely()
glm::vec3 ne::MathHelpers::normalizeSafely |
( |
const glm::vec3 & |
vector | ) |
|
|
inlinestatic |
Normalizes the specified vector while checking for zero division (to avoid NaNs in the normalized vector).
- Parameters
-
vector | Input vector to normalize. |
- Returns
- Normalized vector.
◆ normalizeToRange()
float ne::MathHelpers::normalizeToRange |
( |
float |
value, |
|
|
float |
min, |
|
|
float |
max |
|
) |
| |
|
inlinestatic |
Changes the value to be in the range [min; max].
Example:
static float normalizeToRange(float value, float min, float max)
Definition: MathHelpers.hpp:229
- Parameters
-
value | Value to normalize. |
min | Minimum value in range. |
max | Maximum value in range. |
- Returns
- Normalized value.
◆ smallFloatEpsilon
const float ne::MathHelpers::smallFloatEpsilon = 0.0000001F |
|
inlinestaticprivate |
Default tolerance for floats to use.
The documentation for this class was generated from the following file: