9#if defined(JPH_USE_SSE4_1)
70 return Quat(x, y, z, w);
153template <
class Random>
156 std::uniform_real_distribution<float>
zero_to_one(0.0f, 1.0f);
158 float r1 = sqrt(1.0f -
x0),
r2 = sqrt(
x0);
159 std::uniform_real_distribution<float>
zero_to_two_pi(0.0f, 2.0f * JPH_PI);
195 t2 =
t2 > 1.0f? 1.0f :
t2;
196 t2 =
t2 < -1.0f? -1.0f :
t2;
241 const float delta = 0.0001f;
293 float tx = 2.0f * x,
tw = 2.0f * w;
302 float ty = 2.0f * y,
tw = 2.0f * w;
311 float tz = 2.0f * z,
tw = 2.0f * w;
324 float w = sqrt(max(1.0f -
v.LengthSq(), 0.0f));
#define JPH_NAMESPACE_END
Definition Core.h:367
#define JPH_NAMESPACE_BEGIN
Definition Core.h:361
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
constexpr T Square(T inV)
Square a value.
Definition Math.h:52
AllocateFunction Allocate
Definition Memory.cpp:59
JPH_INLINE float ACos(float inX)
Definition Trigonometry.h:42
JPH_INLINE float ATan2(float inY, float inX)
Arc tangent of y / x using the signs of the arguments to determine the correct quadrant (returns valu...
Definition Trigonometry.h:54
JPH_NAMESPACE_BEGIN JPH_INLINE float Sin(float inX)
Sine of x (input in radians)
Definition Trigonometry.h:12
JPH_INLINE float ASin(float inX)
Definition Trigonometry.h:35
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition Float3.h:13
static Quat sRandom(Random &inRandom)
Random unit quaternion.
Definition Quat.inl:154
JPH_INLINE Vec3 InverseRotate(Vec3Arg inValue) const
Rotate a vector by the inverse of this quaternion.
Definition Quat.inl:282
JPH_INLINE float GetW() const
Get W component (real part)
Definition Quat.h:78
static Quat sEulerAngles(Vec3Arg inAngles)
Conversion from Euler angles. Rotation order is X then Y then Z (RotZ * RotY * RotX)....
Definition Quat.inl:165
JPH_INLINE float GetY() const
Get Y component (imaginary part j)
Definition Quat.h:72
JPH_INLINE float GetZ() const
Get Z component (imaginary part k)
Definition Quat.h:75
static JPH_INLINE Quat sRotation(Vec3Arg inAxis, float inAngle)
Rotation from axis and angle.
Definition Quat.inl:74
JPH_INLINE float GetX() const
Get X component (imaginary part i)
Definition Quat.h:69
JPH_INLINE Quat LERP(QuatArg inDestination, float inFraction) const
Definition Quat.inl:232
static JPH_INLINE Quat sLoadFloat3Unsafe(const Float3 &inV)
Load 3 floats from memory (X, Y and Z component and then calculates W) reads 32 bits extra which it d...
Definition Quat.inl:321
JPH_INLINE void GetAxisAngle(Vec3 &outAxis, float &outAngle) const
Get axis and angle that represents this quaternion, outAngle will always be in the range .
Definition Quat.inl:83
static JPH_INLINE Quat sIdentity()
Definition Quat.h:103
JPH_INLINE void GetSwingTwist(Quat &outSwing, Quat &outTwist) const
Definition Quat.inl:215
static JPH_INLINE Quat sFromTo(Vec3Arg inFrom, Vec3Arg inTo)
Definition Quat.inl:100
friend Quat operator*(float inValue, QuatArg inRHS)
Definition Quat.h:154
JPH_INLINE Quat EnsureWPositive() const
Ensures that the W component is positive by negating the entire quaternion if it is not....
Definition Quat.h:184
JPH_INLINE Quat GetTwist(Vec3Arg inAxis) const
Definition Quat.inl:205
JPH_INLINE float Dot(QuatArg inRHS) const
Dot product.
Definition Quat.h:175
Quat()=default
Intentionally not initialized for performance reasons.
JPH_INLINE Vec3 RotateAxisZ() const
Rotate a the vector (0, 0, 1) with this quaternion.
Definition Quat.inl:306
JPH_INLINE Quat Conjugated() const
The conjugate [w, -x, -y, -z] is the same as the inverse for unit quaternions.
Definition Quat.h:178
JPH_INLINE Vec3 RotateAxisX() const
Rotate a the vector (1, 0, 0) with this quaternion.
Definition Quat.inl:288
JPH_INLINE Vec3 RotateAxisY() const
Rotate a the vector (0, 1, 0) with this quaternion.
Definition Quat.inl:297
Vec3 GetEulerAngles() const
Conversion to Euler angles. Rotation order is X then Y then Z (RotZ * RotY * RotX)....
Definition Quat.inl:185
bool IsNormalized(float inTolerance=1.0e-5f) const
If the length of this quaternion is 1 +/- inTolerance.
Definition Quat.h:59
JPH_INLINE void StoreFloat3(Float3 *outV) const
Store 3 as floats to memory (X, Y and Z component)
Definition Quat.inl:315
JPH_INLINE Vec3 GetXYZ() const
Get the imaginary part of the quaternion.
Definition Quat.h:81
Vec4 mValue
4 vector that stores [x, y, z, w] parts of the quaternion
Definition Quat.h:248
JPH_INLINE Quat SLERP(QuatArg inDestination, float inFraction) const
Definition Quat.inl:238
JPH_INLINE Vec3 Normalized() const
Normalize vector.
Definition Vec3.inl:694
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition Vec3.inl:582
JPH_INLINE void StoreFloat3(Float3 *outV) const
Store 3 floats to memory.
Definition Vec3.inl:757
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107
static JPH_INLINE Vec3 sLoadFloat3Unsafe(const Float3 &inV)
Load 3 floats from memory (reads 32 bits extra which it doesn't use)
Definition Vec3.inl:134
JPH_INLINE float GetW() const
Definition Vec4.h:116
static JPH_INLINE Vec4 sSelect(Vec4Arg inV1, Vec4Arg inV2, UVec4Arg inControl)
Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of in...
Definition Vec4.inl:254
JPH_INLINE float GetX() const
Get individual components.
Definition Vec4.h:113
Type mValue
Definition Vec4.h:274
JPH_INLINE float GetZ() const
Definition Vec4.h:115
JPH_INLINE float GetY() const
Definition Vec4.h:114
static JPH_INLINE Vec4 sReplicate(float inV)
Replicate inV across all components.
Definition Vec4.inl:74
void SinCos(Vec4 &outSin, Vec4 &outCos) const
Calculate the sine and cosine for each element of this vector (input in radians)
Definition Vec4.inl:767