#include <TQuaternion.h>
|
| TQuaternion () |
|
| TQuaternion (const TQuaternion &a_pQuaternion) |
|
| TQuaternion (TFLOAT a_fX, TFLOAT a_fY, TFLOAT a_fZ, TFLOAT a_fW) |
|
void | Set (TFLOAT a_fX, TFLOAT a_fY, TFLOAT a_fZ, TFLOAT a_fW) |
|
void | SetIdentity () |
|
void | SetFromEulerYX (const TFLOAT *fVal) |
|
void | SetFromEulerRollPitchYaw (TFLOAT a_fRoll, TFLOAT a_fPitch, TFLOAT a_fYaw) |
|
void | SetConjugate () |
|
void | SetInverse () |
|
void | SetRotation (const TVector3 &a_rVec3, TFLOAT a_fVal) |
|
void | SetVectorDirection (const TVector3 &a_rVec3, const TVector3 &a_rVec3_2) |
|
void | RotateAroundAxis (const TVector3 ¶m_1, TFLOAT param_2) |
|
void | Negate () |
|
void | GetEulerXYZ (TVector3 &outVec) const |
|
TFLOAT | Magnitude () const |
|
TFLOAT | MagnitudeSq () const |
|
const TVector4 & | AsVector4 () const |
|
TVector4 & | AsVector4 () |
|
void | operator= (const TQuaternion &other) |
|
TQuaternion & | operator*= (const TQuaternion &a_rQuat) |
|
Definition at line 18 of file TQuaternion.h.
◆ TQuaternion() [1/3]
TQuaternion::TQuaternion |
( |
| ) |
|
|
inline |
Definition at line 21 of file TQuaternion.h.
22 :
x( 0.0f ),
y( 0.0f ),
z( 0.0f ),
w( 1.0f )
23 {}
◆ TQuaternion() [2/3]
TQuaternion::TQuaternion |
( |
const TQuaternion & | a_pQuaternion | ) |
|
|
inline |
Definition at line 25 of file TQuaternion.h.
26 :
x( a_pQuaternion.
x ),
y( a_pQuaternion.
y ),
z( a_pQuaternion.
z ),
w( a_pQuaternion.
w ) {}
◆ TQuaternion() [3/3]
Definition at line 28 of file TQuaternion.h.
29 :
x( a_fX ),
y( a_fY ),
z( a_fZ ),
w( a_fW ) {}
◆ AsVector4() [1/2]
Definition at line 67 of file TQuaternion.h.
67{ return reinterpret_cast<TVector4&>( *this ); }
◆ AsVector4() [2/2]
const TVector4 & TQuaternion::AsVector4 |
( |
| ) |
const |
|
inline |
Definition at line 66 of file TQuaternion.h.
66{ return reinterpret_cast<const TVector4&>( *this ); }
◆ GetEulerXYZ()
void TQuaternion::GetEulerXYZ |
( |
TVector3 & | outVec | ) |
const |
Definition at line 109 of file TQuaternion.cpp.
110{
111 TMatrix44 matrix;
113
115}
void GetEulerXYZ(TVector3 &a_rOutVec) const
TMatrix44 & SetFromQuaternion(const TQuaternion &a_rQuaternion)
◆ Magnitude()
TFLOAT TQuaternion::Magnitude |
( |
| ) |
const |
|
inline |
Definition at line 63 of file TQuaternion.h.
TFORCEINLINE TFLOAT Sqrt(TFLOAT a_fX)
◆ MagnitudeSq()
TFLOAT TQuaternion::MagnitudeSq |
( |
| ) |
const |
|
inline |
◆ Negate()
void TQuaternion::Negate |
( |
| ) |
|
|
inline |
Definition at line 60 of file TQuaternion.h.
void Set(TFLOAT a_fX, TFLOAT a_fY, TFLOAT a_fZ, TFLOAT a_fW)
◆ Nlerp()
Definition at line 129 of file TQuaternion.cpp.
130{
132
133 if ( 0.0f <= fDot )
134 {
136
139
140 a_rOut.
x = vec.
x + a_rStart.
x;
141 a_rOut.
y = vec.
y + a_rStart.
y;
142 a_rOut.
z = vec.
z + a_rStart.
z;
143 a_rOut.
w = vec.
w + a_rStart.
w;
144
146 }
147 else
148 {
152
153 a_rOut.
x = vec.
x - a_rStart.
x;
154 a_rOut.
y = vec.
y - a_rStart.
y;
155 a_rOut.
z = vec.
z - a_rStart.
z;
156 a_rOut.
w = vec.
w - a_rStart.
w;
157
159 }
160}
const TVector4 & AsVector4() const
constexpr void Add4(const TVector4 &vec)
TFLOAT constexpr DotProduct4(const TVector4 &vec) const
constexpr void Substract4(const TVector4 &vec)
constexpr void Multiply4(const TVector4 &vec)
◆ operator*=()
Definition at line 118 of file TQuaternion.cpp.
119{
120 TFLOAT fX = ( (
x * a_Quat.w + a_Quat.z *
y ) - a_Quat.y *
z ) + a_Quat.x *
w;
121 TFLOAT fY = a_Quat.x *
z + (
y * a_Quat.w - a_Quat.z *
x ) + a_Quat.y *
w;
122 TFLOAT fZ =
w * a_Quat.z + ( a_Quat.y *
x - a_Quat.x *
y ) +
z * a_Quat.w;
123 TFLOAT fW = ( -( a_Quat.y *
y + a_Quat.x *
x ) - a_Quat.z *
z ) + a_Quat.w *
w;
124 Set( fX, fY, fZ, fW );
125 return *this;
126}
◆ operator=()
void TQuaternion::operator= |
( |
const TQuaternion & | other | ) |
|
|
inline |
◆ RotateAroundAxis()
void TQuaternion::RotateAroundAxis |
( |
const TVector3 & | param_1, |
|
|
TFLOAT | param_2 ) |
Definition at line 100 of file TQuaternion.cpp.
101{
104
106 *
this *=
TQuaternion( param_1.
x * fVal, param_1.
y * fVal, param_1.
z * fVal, fVal2 );
107}
TFORCEINLINE void SinCos(TFLOAT fVal, TFLOAT &a_rSin, TFLOAT &a_rCos)
◆ RotateVector()
Definition at line 87 of file TQuaternion.cpp.
88{
93 quat3 *= quat2;
94 quat3 *= quat;
95
96 param_1.
Set( quat3.
x, quat3.
y, quat3.
z );
97}
constexpr void Set(const TVector3 &vec)
◆ Set()
◆ SetConjugate()
void TQuaternion::SetConjugate |
( |
| ) |
|
|
inline |
Definition at line 52 of file TQuaternion.h.
constexpr void Negate3(const TVector4 &vec)
◆ SetFromEulerRollPitchYaw()
void TQuaternion::SetFromEulerRollPitchYaw |
( |
TFLOAT | a_fRoll, |
|
|
TFLOAT | a_fPitch, |
|
|
TFLOAT | a_fYaw ) |
Definition at line 21 of file TQuaternion.cpp.
22{
23 TFLOAT fCosRoll = cos( a_fRoll * 0.5f );
24 TFLOAT fSinRoll = sin( a_fRoll * 0.5f );
25 TFLOAT fCosPitch = cos( a_fPitch * 0.5f );
26 TFLOAT fSinPitch = sin( a_fPitch * 0.5f );
27 TFLOAT fCosYaw = cos( a_fYaw * 0.5f );
28 TFLOAT fSinYaw = sin( a_fYaw * 0.5f );
29
30 TFLOAT fX = fCosYaw * fCosPitch * fSinRoll - fSinYaw * fSinPitch * fCosRoll;
31 TFLOAT fY = fCosPitch * fSinRoll * fSinYaw + fSinPitch * fCosRoll * fCosYaw;
32 TFLOAT fZ = fCosRoll * fCosPitch * fSinYaw - fCosYaw * fSinPitch * fSinRoll;
33 TFLOAT fW = fSinYaw * fSinPitch * fSinRoll + fCosYaw * fCosPitch * fCosRoll;
34
35 Set( fX, fY, fZ, fW );
36}
◆ SetFromEulerYX()
void TQuaternion::SetFromEulerYX |
( |
const TFLOAT * | fVal | ) |
|
◆ SetIdentity()
void TQuaternion::SetIdentity |
( |
| ) |
|
|
inline |
Definition at line 39 of file TQuaternion.h.
40 {
46 );
47 }
static const TQuaternion IDENTITY
◆ SetInverse()
void TQuaternion::SetInverse |
( |
| ) |
|
|
inline |
◆ SetRotation()
void TQuaternion::SetRotation |
( |
const TVector3 & | a_rVec3, |
|
|
TFLOAT | a_fVal ) |
Definition at line 39 of file TQuaternion.cpp.
40{
43
45 Set( a_rVec3.
x * fVal, a_rVec3.
y * fVal, a_rVec3.
z * fVal, fVal2 );
46}
◆ SetVectorDirection()
void TQuaternion::SetVectorDirection |
( |
const TVector3 & | a_rVec3, |
|
|
const TVector3 & | a_rVec3_2 ) |
Definition at line 49 of file TQuaternion.cpp.
50{
51 TVector3 vec3;
53
55
57 {
62 {
64 }
66 return;
67 }
68
70
71 if ( dotProduct < 0.0f )
72 {
73 TVector3 vec = a_rVec3_2;
75 {
77 }
78 else
79 {
81 }
84 }
85}
TFORCEINLINE TFLOAT Abs(TFLOAT fVal)
constexpr TFLOAT TFLOAT_EPSILON
TFORCEINLINE TFLOAT ACos(TFLOAT fVal)
void SetRotation(const TVector3 &a_rVec3, TFLOAT a_fVal)
void RotateAroundAxis(const TVector3 ¶m_1, TFLOAT param_2)
constexpr void Divide(const TVector3 &vec)
void CrossProduct(const TVector3 &, const TVector3 &)
void RotateX(TFLOAT a_fRotation)
void RotateY(TFLOAT a_fRotation)
static constexpr TFLOAT DotProduct(const TVector3 &vec1, const TVector3 &vec2)
◆ Slerp()
Definition at line 163 of file TQuaternion.cpp.
164{
165 if ( a_fProgress == 0.0f )
166 {
167 a_rOut = a_rStart;
168 return;
169 }
170
171 if ( a_fProgress == 1.0f )
172 {
173 a_rOut = a_rEnd;
174 return;
175 }
176
178 TBOOL bNegativeDot = fDot < 0.0f;
179
180 if ( bNegativeDot )
181 fDot *= -1;
182
183 TFLOAT fProg1 = a_fProgress;
185
186 if ( 1.0f - fDot <= 0.001f )
187 {
188 fProg2 = 1.0f - a_fProgress;
189 }
190 else
191 {
194
195 fProg1 =
TMath::Sin( fAcos * a_fProgress ) * ( 1.0f / fSin );
196 fProg2 =
TMath::Sin( ( 1.0f - a_fProgress ) * fAcos ) * ( 1.0f / fSin );
197 }
198
199 if ( bNegativeDot )
200 {
201 a_rOut.
x = a_rStart.
x * fProg2 - a_rEnd.
x * fProg1;
202 a_rOut.
y = a_rStart.
y * fProg2 - a_rEnd.
y * fProg1;
203 a_rOut.
z = a_rStart.
z * fProg2 - a_rEnd.
z * fProg1;
204 a_rOut.
w = a_rStart.
w * fProg2 - a_rEnd.
w * fProg1;
205 }
206 else
207 {
208 a_rOut.
x = a_rStart.
x * fProg2 + a_rEnd.
x * fProg1;
209 a_rOut.
y = a_rStart.
y * fProg2 + a_rEnd.
y * fProg1;
210 a_rOut.
z = a_rStart.
z * fProg2 + a_rEnd.
z * fProg1;
211 a_rOut.
w = a_rStart.
w * fProg2 + a_rEnd.
w * fProg1;
212 }
213}
TFORCEINLINE TFLOAT Sin(TFLOAT fVal)
◆ DELTA
TFLOAT TQuaternion::DELTA = 0.001f |
|
inlinestaticconstexpr |
◆ IDENTITY
const TQuaternion TQuaternion::IDENTITY = { 0.0f, 0.0f, 0.0f, 1.0f } |
|
static |
The documentation for this class was generated from the following files: