Plasma Engine  2.0
Loading...
Searching...
No Matches
plSimdQuat Class Reference

Public Member Functions

 PL_DECLARE_POD_TYPE ()
 
 plSimdQuat (const plSimdVec4f &v)
 
void Normalize ()
 Normalizes the quaternion to unit length. ALL rotation-quaternions should be normalized at all times (automatically).
 
plResult GetRotationAxisAndAngle (plSimdVec4f &ref_vAxis, plSimdFloat &ref_fAngle, const plSimdFloat &fEpsilon=plMath::DefaultEpsilon< float >()) const
 Returns the rotation-axis and angle (in Radians), that this quaternion rotates around.
 
plSimdMat4f GetAsMat4 () const
 Returns the Quaternion as a matrix.
 
bool IsValid (const plSimdFloat &fEpsilon=plMath::DefaultEpsilon< float >()) const
 Checks whether all components are neither NaN nor infinite and that the quaternion is normalized.
 
bool IsNaN () const
 Checks whether any component is NaN.
 
bool IsEqualRotation (const plSimdQuat &qOther, const plSimdFloat &fEpsilon) const
 Determines whether this and qOther represent the same rotation. This is a rather slow operation.
 
plSimdQuat operator- () const
 Returns a Quaternion that represents the negative / inverted rotation.
 
plSimdVec4f operator* (const plSimdVec4f &v) const
 Rotates v by q.
 
plSimdQuat operator* (const plSimdQuat &q2) const
 Concatenates the rotations of q1 and q2.
 
bool operator== (const plSimdQuat &q2) const
 
bool operator!= (const plSimdQuat &q2) const
 

Static Public Member Functions

static const plSimdQuat MakeIdentity ()
 Static function that returns a quaternion that represents the identity rotation (none).
 
static plSimdQuat MakeFromElements (plSimdFloat x, plSimdFloat y, plSimdFloat z, plSimdFloat w)
 Sets the individual elements of the quaternion directly. Note that x,y,z do NOT represent a rotation axis, and w does NOT represent an angle.
 
static plSimdQuat MakeFromAxisAndAngle (const plSimdVec4f &vRotationAxis, const plSimdFloat &fAngle)
 Creates a quaternion from a rotation-axis and an angle (angle is given in Radians or as an plAngle)
 
static plSimdQuat MakeShortestRotation (const plSimdVec4f &vDirFrom, const plSimdVec4f &vDirTo)
 Creates a quaternion, that rotates through the shortest arc from "vDirFrom" to "vDirTo".
 
static plSimdQuat MakeSlerp (const plSimdQuat &qFrom, const plSimdQuat &qTo, const plSimdFloat &t)
 Returns a quaternion that is the spherical linear interpolation of the other two.
 

Public Attributes

plSimdVec4f m_v
 

Member Function Documentation

◆ GetRotationAxisAndAngle()

plResult plSimdQuat::GetRotationAxisAndAngle ( plSimdVec4f & ref_vAxis,
plSimdFloat & ref_fAngle,
const plSimdFloat & fEpsilon = plMath::DefaultEpsilon<float>() ) const
inline

Returns the rotation-axis and angle (in Radians), that this quaternion rotates around.

Todo
optimize

◆ IsEqualRotation()

bool plSimdQuat::IsEqualRotation ( const plSimdQuat & qOther,
const plSimdFloat & fEpsilon ) const

Determines whether this and qOther represent the same rotation. This is a rather slow operation.

Currently it fails when one of the given quaternions is identity (so no rotation, at all), as it tries to compare rotation axis' and angles, which is undefined for the identity quaternion (also there are infinite representations for 'identity', so it's difficult to check for it).

◆ MakeFromAxisAndAngle()

plSimdQuat plSimdQuat::MakeFromAxisAndAngle ( const plSimdVec4f & vRotationAxis,
const plSimdFloat & fAngle )
inlinestaticnodiscard

Creates a quaternion from a rotation-axis and an angle (angle is given in Radians or as an plAngle)

Todo
optimize

◆ MakeFromElements()

PL_ALWAYS_INLINE plSimdQuat plSimdQuat::MakeFromElements ( plSimdFloat x,
plSimdFloat y,
plSimdFloat z,
plSimdFloat w )
staticnodiscard

Sets the individual elements of the quaternion directly. Note that x,y,z do NOT represent a rotation axis, and w does NOT represent an angle.

Use this function only if you have good understanding of quaternion math and know exactly what you are doing.


The documentation for this class was generated from the following files: