mRotation.cpp
Engine/source/math/mRotation.cpp
Public Functions
DefineEngineFunction(AddRotation , RotationF , (RotationF a, RotationF b) , "Adds two rotations <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">together.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Rotation one." "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Rotation two." "@returns v sum of both rotations." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationDirection , Point3F , (RotationF rot) , "Gets the direction from the rotation's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">angles.\n</a>" "@param Our rotation." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationForwardVector , VectorF , (RotationF rot) , "Get the forward vector of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationRightVector , VectorF , (RotationF rot) , "Gets the right vector of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Our rotation." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationUpVector , VectorF , (RotationF rot) , "Gets the up vector of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Our rotation." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(InterpolateRotation , RotationF , (RotationF a, RotationF b, F32 factor) , "Interpolates between two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotations.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Rotation one." "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Rotation two." "@param factor The amount <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> interpolate between the two." "@returns v, interpolated result." " @ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(RotationLookAt , RotationF , (Point3F origin, Point3F target, Point3F up) , (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)) , "Provides <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> rotation orientation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> look at <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> target from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" "@param origin Position of the object doing the looking." "@param target Position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be looked at." "@param up The up angle <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orient the rotation." "@returns v orientation result." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(setRotationRightVector , RotationF , (RotationF rot, VectorF rightVec) , "Sets the right vector of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Starting rotation." "@param New up vector." "@returns New rotation with the set right vector." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(setRotationUpVector , RotationF , (RotationF rot, VectorF upVec) , "Sets the up vector of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Starting rotation." "@param New up vector." "@returns New rotation with the set up vector." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(SubtractRotation , RotationF , (RotationF a, RotationF b) , "Subtracts two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotations.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Rotation one." "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Rotation two." "@returns v difference of both rotations." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
Detailed Description
Public Functions
DefineEngineFunction(AddRotation , RotationF , (RotationF a, RotationF b) , "Adds two rotations <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">together.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Rotation one." "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Rotation two." "@returns v sum of both rotations." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationDirection , Point3F , (RotationF rot) , "Gets the direction from the rotation's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">angles.\n</a>" "@param Our rotation." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationForwardVector , VectorF , (RotationF rot) , "Get the forward vector of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationRightVector , VectorF , (RotationF rot) , "Gets the right vector of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Our rotation." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(getRotationUpVector , VectorF , (RotationF rot) , "Gets the up vector of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Our rotation." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(InterpolateRotation , RotationF , (RotationF a, RotationF b, F32 factor) , "Interpolates between two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotations.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Rotation one." "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Rotation two." "@param factor The amount <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> interpolate between the two." "@returns v, interpolated result." " @ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(RotationLookAt , RotationF , (Point3F origin, Point3F target, Point3F up) , (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)) , "Provides <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> rotation orientation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> look at <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> target from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" "@param origin Position of the object doing the looking." "@param target Position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be looked at." "@param up The up angle <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orient the rotation." "@returns v orientation result." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(setRotationRightVector , RotationF , (RotationF rot, VectorF rightVec) , "Sets the right vector of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Starting rotation." "@param New up vector." "@returns New rotation with the set right vector." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(setRotationUpVector , RotationF , (RotationF rot, VectorF upVec) , "Sets the up vector of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotation.\n</a>" "@param Starting rotation." "@param New up vector." "@returns New rotation with the set up vector." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
DefineEngineFunction(SubtractRotation , RotationF , (RotationF a, RotationF b) , "Subtracts two <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">rotations.\n</a>" "@param <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Rotation one." "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a91b64995742fd30063314f12340b4b5a">b</a> Rotation two." "@returns v difference of both rotations." "@ingroup <a href="/coding/class/structmath/">Math</a>" )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23#include "math/mRotation.h" 24#include "console/console.h" 25#include "console/engineAPI.h" 26#include "math/mathUtils.h" 27 28#ifdef TORQUE_TESTS_ENABLED 29#include "testing/unitTesting.h" 30#endif 31 32//==================================================================== 33//Eulers setup 34//==================================================================== 35RotationF::RotationF(EulerF _euler, UnitFormat format) 36{ 37 set(_euler.x, _euler.y, _euler.z, format); 38} 39 40RotationF::RotationF(F32 _x, F32 _y, F32 _z, UnitFormat format) 41{ 42 set(_x, _y, _z, format); 43} 44 45void RotationF::set(EulerF _euler, UnitFormat format) 46{ 47 x = format == Degrees ? mDegToRad(_euler.x) : _euler.x; 48 y = format == Degrees ? mDegToRad(_euler.y) : _euler.y; 49 z = format == Degrees ? mDegToRad(_euler.z) : _euler.z; 50 51 mRotationType = Euler; 52} 53 54void RotationF::set(F32 _x, F32 _y, F32 _z, UnitFormat format) 55{ 56 EulerF tempEul; 57 if (format == Degrees) 58 { 59 tempEul.set(mDegToRad(_x), mDegToRad(_y), mDegToRad(_z)); 60 } 61 else 62 { 63 tempEul.set(_x, _y, _z); 64 } 65 66 set(tempEul); 67} 68 69//==================================================================== 70//AxisAngle setup 71//==================================================================== 72RotationF::RotationF(AngAxisF _aa, UnitFormat format) 73{ 74 set(_aa, format); 75} 76 77void RotationF::set(AngAxisF _aa, UnitFormat format) 78{ 79 x = _aa.axis.x; 80 y = _aa.axis.y; 81 z = _aa.axis.z; 82 83 w = format == Degrees ? mDegToRad(_aa.angle) : _aa.angle; 84 85 mRotationType = AxisAngle; 86} 87 88//==================================================================== 89//QuatF setup 90//==================================================================== 91RotationF::RotationF(QuatF _quat) 92{ 93 set(_quat); 94} 95 96void RotationF::set(QuatF _quat) 97{ 98 AngAxisF tmpAA; 99 tmpAA.set(_quat); 100 101 set(tmpAA); 102} 103 104//==================================================================== 105//MatrixF setup 106//==================================================================== 107RotationF::RotationF(MatrixF _mat) 108{ 109 set(_mat); 110} 111 112void RotationF::set(MatrixF _mat) 113{ 114 set(_mat.toEuler()); 115} 116 117// 118inline F32 RotationF::len() const 119{ 120 return asEulerF().len(); 121} 122 123inline void RotationF::interpolate(const RotationF& _from, const RotationF& _to, F32 _factor) 124{ 125 QuatF tmpQuat; 126 127 tmpQuat.interpolate(_from.asQuatF(), _to.asQuatF(), _factor); 128 129 set(tmpQuat); 130} 131 132void RotationF::lookAt(const Point3F& _origin, const Point3F& _target, const Point3F& _up) 133{ 134 MatrixF mat; 135 136 VectorF newForward = _target - _origin; 137 newForward.normalize(); 138 139 VectorF up(0.0f, 0.0f, 1.0f); 140 VectorF axisX; 141 VectorF axisY = newForward; 142 VectorF axisZ; 143 144 if (_up != VectorF::Zero) 145 up = _up; 146 147 // Validate and normalize input: 148 F32 lenSq; 149 lenSq = axisY.lenSquared(); 150 if (lenSq < 0.000001f) 151 { 152 //degenerate forward vector 153 axisY.set(0.0f, 1.0f, 0.0f); 154 } 155 else 156 { 157 axisY /= mSqrt(lenSq); 158 } 159 160 161 lenSq = up.lenSquared(); 162 if (lenSq < 0.000001f) 163 { 164 //degenerate up vector - too small 165 up.set(0.0f, 0.0f, 1.0f); 166 } 167 else 168 { 169 up /= mSqrt(lenSq); 170 } 171 172 if (fabsf(mDot(up, axisY)) > 0.9999f) 173 { 174 //degenerate up vector - same as forward 175 F32 tmp = up.x; 176 up.x = -up.y; 177 up.y = up.z; 178 up.z = tmp; 179 } 180 181 // construct the remaining axes: 182 mCross(axisY, up, &axisX); 183 mCross(axisX, axisY, &axisZ); 184 185 mat.setColumn(0, axisX); 186 mat.setColumn(1, axisY); 187 mat.setColumn(2, axisZ); 188 189 set(mat); 190} 191 192VectorF RotationF::getDirection() 193{ 194 VectorF dir; 195 EulerF angles = asEulerF(); 196 MathUtils::getVectorFromAngles(dir, angles.z, angles.x); 197 198 return dir; 199} 200 201//======================================================== 202EulerF RotationF::asEulerF(UnitFormat _format) const 203{ 204 if (mRotationType == Euler) 205 { 206 if (_format == Degrees) 207 { 208 return EulerF(mRadToDeg(x), mRadToDeg(y), mRadToDeg(z)); 209 } 210 else 211 { 212 return EulerF(x, y, z); 213 } 214 } 215 else 216 { 217 EulerF returnEuler = asMatrixF().toEuler(); 218 219 if (_format == Degrees) 220 { 221 returnEuler.x = mRadToDeg(returnEuler.x); 222 returnEuler.y = mRadToDeg(returnEuler.y); 223 returnEuler.z = mRadToDeg(returnEuler.z); 224 } 225 226 return returnEuler; 227 } 228} 229 230AngAxisF RotationF::asAxisAngle(UnitFormat format) const 231{ 232 AngAxisF returnAA; 233 234 if (mRotationType == Euler) 235 { 236 returnAA.set(EulerF(x, y, z)); 237 } 238 else 239 { 240 returnAA.set(Point3F(x, y, z), w); 241 } 242 243 if (format == Radians) 244 { 245 returnAA.angle = mDegToRad(returnAA.angle); 246 } 247 248 return returnAA; 249} 250 251MatrixF RotationF::asMatrixF() const 252{ 253 MatrixF returnMat; 254 if (mRotationType == Euler) 255 { 256 MatrixF imat, xmat, ymat, zmat; 257 xmat.set(EulerF(x, 0, 0)); 258 ymat.set(EulerF(0.0f, y, 0.0f)); 259 zmat.set(EulerF(0, 0, z)); 260 imat.mul(zmat, xmat); 261 returnMat.mul(imat, ymat); 262 } 263 else 264 { 265 AngAxisF aa; 266 aa.set(Point3F(x, y, z), w); 267 268 MatrixF tempMat; 269 aa.setMatrix(&tempMat); 270 271 EulerF eul = tempMat.toEuler(); 272 273 MatrixF imat, xmat, ymat, zmat; 274 xmat.set(EulerF(eul.x, 0, 0)); 275 ymat.set(EulerF(0.0f, eul.y, 0.0f)); 276 zmat.set(EulerF(0, 0, eul.z)); 277 imat.mul(zmat, xmat); 278 returnMat.mul(imat, ymat); 279 } 280 281 return returnMat; 282} 283 284QuatF RotationF::asQuatF() const 285{ 286 QuatF returnQuat; 287 if (mRotationType == Euler) 288 { 289 returnQuat.set(EulerF(x, y, z)); 290 } 291 else 292 { 293 AngAxisF aa; 294 aa.set(Point3F(x, y, z), w); 295 296 returnQuat.set(aa); 297 } 298 299 return returnQuat; 300} 301 302void RotationF::normalize() 303{ 304 if (mRotationType == Euler) 305 { 306 EulerF eul = EulerF(x, y, z); 307 eul.normalize(); 308 set(eul); 309 } 310 else 311 { 312 QuatF quat; 313 quat.set(Point3F(x, y, z), w); 314 315 quat.normalize(); 316 317 set(quat); 318 } 319} 320 321//Testing 322#ifdef TORQUE_TESTS_ENABLED 323TEST(Maths, RotationF_Calculations) 324{ 325 //TODO: implement unit test 326}; 327#endif 328 329DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b), , 330 "Adds two rotations together.\n" 331 "@param a Rotation one." 332 "@param b Rotation two." 333 "@returns v sum of both rotations." 334 "@ingroup Math") 335{ 336 return a + b; 337} 338 339DefineEngineFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , 340 "Subtracts two rotations.\n" 341 "@param a Rotation one." 342 "@param b Rotation two." 343 "@returns v difference of both rotations." 344 "@ingroup Math") 345{ 346 return a - b; 347} 348 349DefineEngineFunction(InterpolateRotation, RotationF, (RotationF a, RotationF b, F32 factor), , 350 "Interpolates between two rotations.\n" 351 "@param a Rotation one." 352 "@param b Rotation two." 353 "@param factor The amount to interpolate between the two." 354 "@returns v, interpolated result." 355 "@ingroup Math") 356{ 357 RotationF result; 358 result.interpolate(a, b, factor); 359 return result; 360} 361 362DefineEngineFunction(RotationLookAt, RotationF, (Point3F origin, Point3F target, Point3F up), 363 (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)), 364 "Provides a rotation orientation to look at a target from a given position.\n" 365 "@param origin Position of the object doing the looking." 366 "@param target Position to be looked at." 367 "@param up The up angle to orient the rotation." 368 "@returns v orientation result." 369 "@ingroup Math") 370{ 371 RotationF result; 372 result.lookAt(origin, target, up); 373 return result; 374} 375 376DefineEngineFunction(setRotationRightVector, RotationF, (RotationF rot, VectorF rightVec), , 377 "Sets the right vector of the rotation.\n" 378 "@param Starting rotation." 379 "@param New up vector." 380 "@returns New rotation with the set right vector." 381 "@ingroup Math") 382{ 383 rot.asMatrixF().setColumn(0, rightVec); 384 return rot; 385} 386 387DefineEngineFunction(setRotationUpVector, RotationF, (RotationF rot, VectorF upVec), , 388 "Sets the up vector of the rotation.\n" 389 "@param Starting rotation." 390 "@param New up vector." 391 "@returns New rotation with the set up vector." 392 "@ingroup Math") 393{ 394 rot.asMatrixF().setColumn(2, upVec); 395 return rot; 396} 397 398DefineEngineFunction(getRotationForwardVector, VectorF, (RotationF rot), , 399 "Get the forward vector of a rotation.\n" 400 "@ingroup Math") 401{ 402 return rot.asMatrixF().getForwardVector(); 403} 404 405DefineEngineFunction(getRotationRightVector, VectorF, (RotationF rot), , 406 "Gets the right vector of a rotation.\n" 407 "@param Our rotation." 408 "@ingroup Math") 409{ 410 return rot.asMatrixF().getRightVector(); 411} 412 413DefineEngineFunction(getRotationUpVector, VectorF, (RotationF rot), , 414 "Gets the up vector of a rotation.\n" 415 "@param Our rotation." 416 "@ingroup Math") 417{ 418 return rot.asMatrixF().getUpVector(); 419} 420 421DefineEngineFunction(getRotationDirection, Point3F, (RotationF rot),, 422 "Gets the direction from the rotation's angles.\n" 423 "@param Our rotation." 424 "@ingroup Math") 425{ 426 return rot.getDirection(); 427} 428