![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
Go to the source code of this file.
Functions | |
| JPH_INLINE constexpr float | DegreesToRadians (float inV) |
| Convert a value from degrees to radians. | |
| JPH_INLINE constexpr float | RadiansToDegrees (float inV) |
| Convert a value from radians to degrees. | |
| float | CenterAngleAroundZero (float inV) |
| Convert angle in radians to the range \([-\pi, \pi]\). | |
| JPH_INLINE float | DifferenceOfProducts (float inA, float inB, float inC, float inD) |
| template<typename T > | |
| JPH_INLINE constexpr T | Clamp (T inV, T inMin, T inMax) |
| Clamp a value between two values. | |
| template<typename T > | |
| JPH_INLINE constexpr T | Square (T inV) |
| Square a value. | |
| JPH_INLINE float | Sqrt (float inV) |
| Take the square root of a float value. | |
| JPH_INLINE double | Sqrt (double inV) |
| Take the square root of a double value. | |
| template<typename T > | |
| JPH_INLINE constexpr T | Cubed (T inV) |
| Returns \(inV^3\). | |
| JPH_INLINE float | MulRSqrtApproximate (float inA, float inB) |
| template<typename T > | |
| JPH_INLINE constexpr T | Sign (T inV) |
| Get the sign of a value. | |
| template<typename T > | |
| constexpr bool | IsPowerOf2 (T inV) |
| Check if inV is a power of 2. | |
| template<typename T > | |
| T | AlignUp (T inV, uint64 inAlignment) |
| Align inV up to the next inAlignment bytes. | |
| template<typename T > | |
| bool | IsAligned (T inV, uint64 inAlignment) |
| Check if inV is inAlignment aligned. | |
| uint | CountTrailingZeros (uint32 inValue) |
| Compute number of trailing zero bits (how many low bits are zero) | |
| uint | CountLeadingZeros (uint32 inValue) |
| Compute the number of leading zero bits (how many high bits are zero) | |
| uint | CountBits (uint32 inValue) |
| Count the number of 1 bits in a value. | |
| uint32 | GetNextPowerOf2 (uint32 inValue) |
| Get the next higher power of 2 of a value, or the value itself if the value is already a power of 2. | |
| template<class To , class From > | |
| JPH_INLINE constexpr To | BitCast (const From &inValue) |
| Simple implementation of C++20 std::bit_cast. | |
|
inline |
Align inV up to the next inAlignment bytes.
|
constexpr |
Simple implementation of C++20 std::bit_cast.
|
inline |
Convert angle in radians to the range \([-\pi, \pi]\).
|
constexpr |
Clamp a value between two values.
Compute the number of leading zero bits (how many high bits are zero)
Compute number of trailing zero bits (how many low bits are zero)
|
constexpr |
Returns \(inV^3\).
|
constexpr |
Convert a value from degrees to radians.
| JPH_INLINE float DifferenceOfProducts | ( | float | inA, |
| float | inB, | ||
| float | inC, | ||
| float | inD ) |
Calculates inA * inB - inC * inD with higher accuracy when fused multiply add instructions are available. If inA * inB and inC * inD are large, the subtraction can cause a large loss of precision when the result is small. See: https://pharr.org/matt/blog/2019/11/03/difference-of-floats (or search for Kahan's algorithm)
Get the next higher power of 2 of a value, or the value itself if the value is already a power of 2.
|
inline |
Check if inV is inAlignment aligned.
|
constexpr |
Check if inV is a power of 2.
| JPH_INLINE float MulRSqrtApproximate | ( | float | inA, |
| float | inB ) |
Calculates approximate inA / Sqrt(inB). Approximate reciprocal square roots are not bit identical between architectures, so the fast paths are only used when cross platform determinism is not required. Note that inB must be bigger or equal than FLT_MIN, otherwise the result can be Inf.
|
constexpr |
Convert a value from radians to degrees.
|
constexpr |
Get the sign of a value.
| JPH_INLINE double Sqrt | ( | double | inV | ) |
Take the square root of a double value.
| JPH_INLINE float Sqrt | ( | float | inV | ) |
Take the square root of a float value.
|
constexpr |
Square a value.