|
hx3d
1
2D/3D Simple Game Framework
|
Math structures and functions. More...
Classes | |
| class | Function |
| Math function definition. More... | |
| class | WeightedRandom |
| Weighted random generator with callbacks. More... | |
Enumerations |
Functions | |
| template<class T > | |
| T | interpolate (T a, T b, float t, Interpolation type) |
| Interpolate between two values. More... | |
| template<class T > | |
| bool | epsEqual (T v1, T v2) |
| Test values equality with epsilon. More... | |
| float | clamp (float value, float min, float max) |
| Simple clamp. More... | |
| float | mclamp (float value, float min, float max) |
| Modulo clamp. More... | |
| int | modulo (int a, int b) |
| Modulo. Handles negative values ! More... | |
| float | log2 (int a) |
| Calculate the log2. More... | |
| float | randfloat () |
| Generate a random float between 0.0 and 1.0. More... | |
| int | random (int min, int max) |
| Generate a random integer between min and max. More... | |
| bool | flip_coin () |
| Generate a random boolean. More... | |
| glm::vec3 | rotate (glm::vec3 vector, float angle, glm::vec3 axis) |
| Rotate a vector of an angle on one/multiple axis. More... | |
| glm::vec2 | cross (glm::vec2 vec, float v) |
| Calculate the cross product vector between a 2D vector and a scalar. More... | |
| glm::vec2 | cross (float v, glm::vec2 vec) |
| Calculate the cross product vector between a scalar and a 2D vector. More... | |
| float | cross (glm::vec2 vec1, glm::vec2 vec2) |
| Calculate the cross product between two 2D vectors. More... | |
| glm::vec2 | normalize (glm::vec2 vec) |
| Normalize a 2D vector. More... | |
| float | squareLength (glm::vec2 vec) |
| Compute the square length of a 2D vector. More... | |
| float | angleBetweenVecs (const glm::vec2 vec1, const glm::vec2 vec2) |
| Compute the angle between two 2D vectors. More... | |
Variables | |
| const float | kEpsilon = 0.0001 |
| Float epsilon. | |
| const double | PI = 3.141592653589793238460 |
| PI. | |
Math structures and functions.
| float hx3d::math::angleBetweenVecs | ( | const glm::vec2 | vec1, |
| const glm::vec2 | vec2 | ||
| ) |
Compute the angle between two 2D vectors.
| vec1 | First vector |
| vec2 | Second vector |
Definition at line 65 of file vector_utils.cpp.
| float hx3d::math::clamp | ( | float | value, |
| float | min, | ||
| float | max | ||
| ) |
Simple clamp.
Block the value between min and max.
| value | Value |
| min | Min |
| max | Max |
Definition at line 28 of file number_utils.cpp.
| glm::vec2 hx3d::math::cross | ( | glm::vec2 | vec, |
| float | v | ||
| ) |
Calculate the cross product vector between a 2D vector and a scalar.
| vec | 2D vector |
| v | Scalar |
Definition at line 44 of file vector_utils.cpp.
| glm::vec2 hx3d::math::cross | ( | float | v, |
| glm::vec2 | vec | ||
| ) |
Calculate the cross product vector between a scalar and a 2D vector.
| v | Scalar |
| vec | 2D vector |
Definition at line 41 of file vector_utils.cpp.
| float hx3d::math::cross | ( | glm::vec2 | vec1, |
| glm::vec2 | vec2 | ||
| ) |
Calculate the cross product between two 2D vectors.
| vec1 | First vector |
| vec2 | Second vector |
Definition at line 47 of file vector_utils.cpp.
|
inline |
Test values equality with epsilon.
| v1 | First value |
| v2 | Second value |
Definition at line 27 of file vector_utils.inl.hpp.
| bool hx3d::math::flip_coin | ( | ) |
| T hx3d::math::interpolate | ( | T | a, |
| T | b, | ||
| float | t, | ||
| Interpolation | type | ||
| ) |
Interpolate between two values.
| a | Starting value |
| b | End value |
| t | Current time (between 0 and 1) |
| type | Interpolation function |
Definition at line 54 of file interpolation.inl.hpp.
| float hx3d::math::log2 | ( | int | a | ) |
| float hx3d::math::mclamp | ( | float | value, |
| float | min, | ||
| float | max | ||
| ) |
Modulo clamp.
Block the value between min and max.
If the value is > to max, it goes back to min. If the value is < to min, it goes back to max.
| value | Value |
| min | Min |
| max | Max |
Definition at line 34 of file number_utils.cpp.
| int hx3d::math::modulo | ( | int | a, |
| int | b | ||
| ) |
Modulo. Handles negative values !
| a | First value |
| b | Second value |
Definition at line 40 of file number_utils.cpp.
| glm::vec2 hx3d::math::normalize | ( | glm::vec2 | vec | ) |
Normalize a 2D vector.
| vec | Vector |
Definition at line 51 of file vector_utils.cpp.
| float hx3d::math::randfloat | ( | ) |
Generate a random float between 0.0 and 1.0.
Definition at line 70 of file random.cpp.
| int hx3d::math::random | ( | int | min, |
| int | max | ||
| ) |
Generate a random integer between min and max.
| min | Min value |
| max | Max value |
Definition at line 74 of file random.cpp.
| glm::vec3 hx3d::math::rotate | ( | glm::vec3 | vector, |
| float | angle, | ||
| glm::vec3 | axis | ||
| ) |
Rotate a vector of an angle on one/multiple axis.
| vector | Vector |
| angle | Angle |
| axis | Direction(s) |
Definition at line 28 of file vector_utils.cpp.
| float hx3d::math::squareLength | ( | glm::vec2 | vec | ) |
Compute the square length of a 2D vector.
| vec | Vector |
Definition at line 61 of file vector_utils.cpp.
1.8.11