#include <OSGQuaternion.h>
Types | |
| typedef TransformationMatrix< ValueTypeT > | MatrixType |
| Quaternion matrix type. | |
| *typedef VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > > | VectorType |
| Quaternion vector type. | |
Public Member Functions | |
Constructors | |
| * | QuaternionBase (void) |
| QuaternionBase (const QuaternionBase &source) | |
| QuaternionBase (const MatrixType &matrix) | |
| QuaternionBase (const VectorType &axis, const ValueTypeT angle) | |
| QuaternionBase (const VectorType &rotateFrom, const VectorType &rotateTo) | |
| Constructor defined by the rotation from from to to. | |
Destructor | |
| *virtual | ~QuaternionBase (void) |
Set | |
| *void | setIdentity (void) |
| Resets the quaternion to be the identity (0., 0., 0., 1.). | |
| void | setValueAsAxisRad (const ValueTypeT *valsP) |
| Sets value of rotation from array interpreted as axis and angle given in radians. | |
| void | setValueAsAxisDeg (const ValueTypeT *valsP) |
| Sets value of rotation from array interpreted as axis and angle given in degrees. | |
| void | setValueAsQuat (const ValueTypeT *valsP) |
| Sets value of rotation from array of 4 components of a quaternion. | |
| void | setValueAsAxisRad (const ValueTypeT x, const ValueTypeT y, const ValueTypeT z, const ValueTypeT w) |
| Sets value of rotation from 4 individual components interpreted as axis and angle in rad. | |
| void | setValueAsAxisDeg (const ValueTypeT x, const ValueTypeT y, const ValueTypeT z, const ValueTypeT w) |
| Sets value of rotation from 4 individual components interpreted as axis and angle in degrees. | |
| void | setValueAsQuat (const ValueTypeT x, const ValueTypeT y, const ValueTypeT z, const ValueTypeT w) |
| Sets value of rotation from 4 individual components interpreted as a quaternion. | |
| void | setValue (const MatrixType &matrix) |
| Sets value of rotation from a rotation matrix. | |
| void | setValueAsAxisRad (const VectorType &axis, ValueTypeT angle) |
| Sets value of quaternion from 3D rotation axis vector and angle in degrees. | |
| void | setValueAsAxisDeg (const VectorType &axis, ValueTypeT angle) |
| Sets value of quaternion from 3D rotation axis vector and angle in degrees. | |
| void | setValue (const VectorType &rotateFrom, const VectorType &rotateTo) |
| Sets rotation to rotate one direction vector to another. | |
| void | setValueAsAxisRad (const Char8 *str) |
| Sets rotation by a given str (like "0.0 1.0 0.0 3.14"), be aware that these values are interpreted as axis, angle in rad. | |
| void | setValueAsAxisDeg (const Char8 *str) |
| Sets rotation by a given str (like "0.0 1.0 0.0 180"), be aware that these values are interpreted as axis, angle in degree. | |
| void | setValueAsQuat (const Char8 *str) |
| Sets rotation by a given str (like "0.0 1.0 0.0 0.0"), be aware that these values are interpreted as a quat. | |
| void | setValue (const ValueTypeT alpha, const ValueTypeT beta, const ValueTypeT gamma) |
| Sets rotation by three given euler angles. | |
Get | |
| *const ValueTypeT * | getValues (void) const |
| Returns pointer to array of 4 components defining quaternion. | |
| void | getValueAsAxisDeg (ValueTypeT &x, ValueTypeT &y, ValueTypeT &z, ValueTypeT &w) const |
| Returns 4 individual components of rotation quaternion as axis and angle in degrees. | |
| void | getValueAsAxisRad (ValueTypeT &x, ValueTypeT &y, ValueTypeT &z, ValueTypeT &w) const |
| Returns 4 individual components of rotation quaternion as axis and angle in degrees. | |
| void | getValueAsQuat (ValueTypeT &x, ValueTypeT &y, ValueTypeT &z, ValueTypeT &w) const |
| Returns 4 individual components of rotation quaternion. | |
| void | getValueAsAxisRad (VectorType &axis, ValueTypeT &radians) const |
| Returns corresponding 3D rotation axis vector and angle in rad. | |
| void | getValueAsAxisDeg (VectorType &axis, ValueTypeT °rees) const |
| Returns corresponding 3D rotation axis vector and angle in degrees. | |
| void | getValue (MatrixType &matrix) const |
| Fills corresponding 4x4 rotation matrix. | |
| void | getValuesOnly (MatrixType &matrix) const |
| Fills the corresponding 3x3 rotation matrix. | |
| ValueTypeT | x (void) const |
| Returns pointer to array of 4 components defining quaternion. | |
| ValueTypeT | y (void) const |
| Returns pointer to array of 4 components defining quaternion. | |
| ValueTypeT | z (void) const |
| Returns pointer to array of 4 components defining quaternion. | |
| ValueTypeT | w (void) const |
| Returns pointer to array of 4 components defining quaternion. | |
Simple Math | |
| *ValueTypeT | length (void) const |
| Returns the 4 dimensional euclidian length of the quaternion. | |
| void | normalize (void) |
| Norm the quaternion to be of unit length. | |
| void | invert (void) |
| Changes a rotation to be its inverse. | |
| const QuaternionBase | inverse (void) const |
| Returns the inverse of a rotation. | |
| void | multVec (const VectorType &src, VectorType &dst) const |
| Puts the given vector through this rotation. | |
| void | scaleAngle (ValueTypeT scaleFactor) |
| Keep the axis the same. Multiply the angle of rotation by the amount 'scaleFactor'. | |
| void | slerpThis (const QuaternionBase &rot0, const QuaternionBase &rot1, const ValueTypeT t) |
| Returns the 4 dimensional euclidian length of the quaternion. | |
| void | mult (const QuaternionBase &other) |
| Returns the 4 dimensional euclidian length of the quaternion. | |
| void | multLeft (const QuaternionBase &other) |
| Returns the 4 dimensional euclidian length of the quaternion. | |
| bool | equals (const QuaternionBase &rot, const ValueTypeT tolerance) const |
| Returns the 4 dimensional euclidian length of the quaternion. | |
Element Access | |
| *ValueTypeT & | operator[] (const UInt32 index) |
| const ValueTypeT & | operator[] (const UInt32 index) const |
Math Operators | |
| *void | operator *= (const QuaternionBase &other) |
Assignment | |
| *const QuaternionBase & | operator= (const QuaternionBase &source) |
Comparison | |
| *bool | operator== (const QuaternionBase &other) const |
| bool | operator!= (const QuaternionBase &other) const |
Static Public Member Functions | |
Class Get | |
| *static const QuaternionBase & | identity (void) |
| Returns identity quaternion. | |
| static QuaternionBase | slerp (const QuaternionBase &rot0, const QuaternionBase &rot1, const ValueTypeT t) |
| Returns the slerp betweet rot0 and rot1 at t. | |
Protected Member Functions | |
| void | mult (const ValueTypeT rVal1[4], const ValueTypeT rVal2[4]) |
Static Protected Member Functions | |
| static void | slerp (const QuaternionBase &rot0, const QuaternionBase &rot1, QuaternionBase &result, const ValueTypeT t) |
| The actual internal slerp code. | |
Private Types | |
| enum | ElementIndices { Q_X = 0, Q_Y = 1, Q_Z = 2, Q_W = 3 } |
Private Attributes | |
| ValueTypeT | _quat [4] |
Static Private Attributes | |
| static QuaternionBase | _identity |
| Identity quaternion. | |
Definition at line 57 of file OSGQuaternion.h.
|
|||||
|
Definition at line 69 of file OSGQuaternion.h. |
|
|||||
|
Definition at line 250 of file OSGQuaternion.h.
|
|
||||||||||
|
Definition at line 98 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat. 00099 { 00100 _quat[0] = 00101 _quat[1] = 00102 _quat[2] = TypeTraits<ValueTypeT>::getZeroElement(); 00103 00104 _quat[3] = TypeTraits<ValueTypeT>::getOneElement(); 00105 }
|
|
||||||||||
|
Definition at line 109 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat. 00110 { 00111 for(UInt32 i = 0; i < 4; i++) 00112 { 00113 _quat[i] = source._quat[i]; 00114 } 00115 }
|
|
||||||||||
|
Definition at line 119 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::setValue(). 00120 { 00121 setValue(matrix); 00122 }
|
|
||||||||||||||||
|
Definition at line 126 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(). 00128 { 00129 setValueAsAxisRad(axis, angle); 00130 }
|
|
||||||||||||||||
|
Definition at line 135 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::setValue(). 00137 { 00138 setValue(rotateFrom, rotateTo); 00139 }
|
|
||||||||||
|
Definition at line 145 of file OSGQuaternion.inl.
|
|
||||||||||
|
Definition at line 74 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_identity. 00075 { 00076 return _identity; 00077 }
|
|
||||||||||||||||||||
|
Definition at line 83 of file OSGQuaternion.inl. Referenced by osg::QuaternionBase< ValueTypeT >::slerpThis(). 00086 { 00087 QuaternionBase returnValue; 00088 00089 slerp(rot0, rot1, returnValue, t); 00090 00091 return returnValue; 00092 }
|
|
||||||||||
|
Definition at line 155 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat. Referenced by osg::QuaternionBase< ValueTypeT >::setValue(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(), and osg::QuaternionBase< ValueTypeT >::setValueAsQuat(). 00156 { 00157 _quat[0] = 00158 _quat[1] = 00159 _quat[2] = TypeTraits<ValueTypeT>::getZeroElement(); 00160 00161 _quat[3] = TypeTraits<ValueTypeT>::getOneElement(); 00162 }
|
|
||||||||||
|
Definition at line 169 of file OSGQuaternion.inl. Referenced by osg::Billboard::calcMatrix(), osg::VRMLTextureTransformDesc::endNode(), osg::FieldDataTraits< Quaternion >::getFromString(), osg::QuaternionBase< ValueTypeT >::QuaternionBase(), osg::TrackballNavigator::rotate(), osg::FlyNavigator::rotate(), osg::QuaternionBase< ValueTypeT >::scaleAngle(), osg::QuaternionBase< ValueTypeT >::setValue(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(), and osg::Trackball::updateRotation(). 00171 { 00172 setValueAsAxisRad(valsP[0], valsP[1], valsP[2], valsP[3]); 00173 }
|
|
||||||||||
|
Definition at line 180 of file OSGQuaternion.inl. Referenced by osg::ProjectionCameraDecorator::getProjectionTranslation(), osg::Trackball::setStartRotation(), and osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(). 00182 { 00183 setValueAsAxisDeg(valsP[0], valsP[1], valsP[2], valsP[3]); 00184 }
|
|
||||||||||
|
Definition at line 189 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat. Referenced by osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(), and osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(). 00191 { 00192 UInt32 i; 00193 00194 for(i = 0; i < 4; i++) 00195 { 00196 _quat[i] = valsP[i]; 00197 } 00198 }
|
|
||||||||||||||||||||||||
|
Definition at line 205 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::Eps, osg::osgcos(), osg::osgsin(), osg::osgsqrt(), and osg::QuaternionBase< ValueTypeT >::setIdentity(). 00209 { 00210 ValueTypeT rTmp = osgsqrt(x * x + y * y + z * z); 00211 00212 if(rTmp > Eps) 00213 { 00214 rTmp = osgsin(w / 2.0f) / rTmp; 00215 00216 _quat[0] = x * rTmp; 00217 _quat[1] = y * rTmp; 00218 _quat[2] = z * rTmp; 00219 _quat[3] = osgcos(w / 2.0f); 00220 } 00221 else 00222 { 00223 setIdentity(); 00224 } 00225 }
|
|
||||||||||||||||||||||||
|
Definition at line 232 of file OSGQuaternion.inl. References osg::osgdegree2rad(), and osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(). 00236 { 00237 setValueAsAxisRad(x,y,z,osgdegree2rad(w)); 00238 }
|
|
||||||||||||||||||||||||
|
Definition at line 245 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat.
|
|
||||||||||
|
Definition at line 259 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::Eps, and osg::osgsqrt(). Referenced by osg::Billboard::calcMatrix(), osg::ExtrusionSurface::calcTransforms(), osg::TransformationMatrix< ValueTypeT >::getTransform(), and osg::QuaternionBase< ValueTypeT >::QuaternionBase(). 00260 { 00261 Real64 tr; 00262 Real64 s; 00263 Real64 qt[3]; 00264 00265 UInt32 i; 00266 UInt32 j; 00267 UInt32 k; 00268 00269 UInt32 nxt[3] = { 1, 2, 0}; 00270 00271 tr = matrix[0][0] + matrix[1][1] + matrix[2][2]; 00272 00273 if(tr > 0.0) 00274 { 00275 s = osgsqrt(tr + 1.0); 00276 00277 _quat[3] = ValueTypeT(s * 0.5); 00278 00279 s = 0.5 / s; 00280 00281 _quat[0] = ValueTypeT((matrix[1][2] - matrix[2][1]) * s); 00282 _quat[1] = ValueTypeT((matrix[2][0] - matrix[0][2]) * s); 00283 _quat[2] = ValueTypeT((matrix[0][1] - matrix[1][0]) * s); 00284 } 00285 else 00286 { 00287 if(matrix[1][1] > matrix[0][0]) 00288 i = 1; 00289 else 00290 i = 0; 00291 00292 if(matrix[2][2] > matrix[i][i]) 00293 i = 2; 00294 00295 j = nxt[i]; 00296 k = nxt[j]; 00297 00298 s = osgsqrt(matrix[i][i] - (matrix[j][j] + matrix[k][k]) + 1.0 ); 00299 00300 qt[i] = s * 0.5; 00301 s = 0.5 / s; 00302 00303 _quat[3] = ValueTypeT((matrix[j][k] - matrix[k][j]) * s); 00304 00305 qt[j] = (matrix[i][j] + matrix[j][i]) * s; 00306 qt[k] = (matrix[i][k] + matrix[k][i]) * s; 00307 00308 _quat[0] = ValueTypeT(qt[0]); 00309 _quat[1] = ValueTypeT(qt[1]); 00310 _quat[2] = ValueTypeT(qt[2]); 00311 } 00312 00313 if(_quat[3] > 1.0 || _quat[3] < -1.0) 00314 { 00315 if(_quat[3] > 1.0 + Eps || _quat[3] < -1.0 - Eps) 00316 { 00317 fprintf(stderr, 00318 "\nMatToQuat: BUG: |quat[4]| (%f) >> 1.0 !\n\n", 00319 _quat[3]); 00320 } 00321 00322 if(_quat[3] > 1.0) 00323 { 00324 _quat[3] = 1.0; 00325 } 00326 else 00327 { 00328 _quat[3] = -1.0; 00329 } 00330 } 00331 }
|
|
||||||||||||||||
|
Definition at line 338 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(). 00340 { 00341 setValueAsAxisRad(axis[0], axis[1], axis[2], angle); 00342 }
|
|
||||||||||||||||
|
Definition at line 349 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(). 00351 { 00352 setValueAsAxisDeg(axis[0], axis[1], axis[2], angle); 00353 }
|
|
||||||||||||||||
|
Definition at line 358 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::cross(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), osg::osgsqrt(), osg::Pi, osg::QuaternionBase< ValueTypeT >::setIdentity(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(), and osg::QuaternionBase< ValueTypeT >::VectorType. 00360 { 00361 VectorType from = rotateFrom; 00362 VectorType to = rotateTo; 00363 VectorType axis; 00364 ValueTypeT cost; 00365 00366 from.normalize(); 00367 to .normalize(); 00368 00369 cost = from.dot(to); 00370 00371 // check for degeneracies 00372 if(cost > 0.99999) 00373 { // vectors are parallel 00374 setIdentity(); 00375 return; 00376 } 00377 else if(cost < -0.99999) 00378 { 00379 // vectors are opposite 00380 // find an axis to rotate around, which should be 00381 // perpendicular to the original axis 00382 // Try cross product with (1,0,0) first, if that's one of our 00383 // original vectors then try (0,1,0). 00384 00385 VectorType cAxis(1.0, 0.0, 0.0); 00386 00387 VectorType tmp = from.cross(cAxis); 00388 00389 if(tmp.length() < 0.00001) 00390 { 00391 cAxis.setValues(0.0, 1.0, 0.0); 00392 00393 tmp = from.cross(cAxis); 00394 } 00395 00396 tmp.normalize(); 00397 00398 setValueAsAxisRad(tmp[0], tmp[1], tmp[2], Pi); 00399 00400 return; 00401 } 00402 00403 axis = rotateFrom.cross(rotateTo); 00404 axis.normalize(); 00405 00406 // use half-angle formulae 00407 // sin^2 t = ( 1 - cos (2t) ) / 2 00408 00409 axis *= ValueTypeT(osgsqrt(0.5 * (1.0 - cost))); 00410 00411 // scale the axis by the sine of half the rotation angle to get 00412 // the normalized quaternion 00413 00414 _quat[0] = axis[0]; 00415 _quat[1] = axis[1]; 00416 _quat[2] = axis[2]; 00417 00418 // cos^2 t = ( 1 + cos (2t) ) / 2 00419 // w part is cosine of half the rotation angle 00420 00421 _quat[3] = ValueTypeT(osgsqrt(0.5 * (1.0 + cost))); 00422 }
|
|
||||||||||
|
Definition at line 430 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::osgfinite(), osg::QuaternionBase< ValueTypeT >::setIdentity(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisRad(), and osg::QuaternionBase< ValueTypeT >::setValueAsQuat(). 00431 { 00432 setValueAsQuat(str); 00433 00434 if(osgfinite(_quat[0]) == 0 || 00435 osgfinite(_quat[1]) == 0 || 00436 osgfinite(_quat[2]) == 0 || 00437 osgfinite(_quat[3]) == 0 ) 00438 { 00439 setIdentity(); 00440 } 00441 else 00442 { 00443 setValueAsAxisRad(_quat[0], _quat[1], _quat[2], _quat[3]); 00444 } 00445 }
|
|
||||||||||
|
Definition at line 452 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::osgfinite(), osg::QuaternionBase< ValueTypeT >::setIdentity(), osg::QuaternionBase< ValueTypeT >::setValueAsAxisDeg(), and osg::QuaternionBase< ValueTypeT >::setValueAsQuat(). 00453 { 00454 setValueAsQuat(str); 00455 00456 if(osgfinite(_quat[0]) == 0 || 00457 osgfinite(_quat[1]) == 0 || 00458 osgfinite(_quat[2]) == 0 || 00459 osgfinite(_quat[3]) == 0 ) 00460 { 00461 setIdentity(); 00462 } 00463 else 00464 { 00465 setValueAsAxisDeg(_quat[0], _quat[1], _quat[2], _quat[3]); 00466 } 00467 }
|
|
||||||||||
|
Definition at line 474 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, and osg::QuaternionBase< ValueTypeT >::setIdentity(). 00475 { 00476 UInt32 i; 00477 UInt32 numOfToken = 4; 00478 00479 Char8 *c = const_cast<Char8 *>(str); 00480 00481 Char8 *tokenC = 0; 00482 Char8 token[256]; 00483 00484 ValueTypeT vec[4]; 00485 00486 if( (str == NULL) || 00487 (*str == '\0') ) 00488 { 00489 setIdentity(); 00490 return; 00491 } 00492 00493 for(i = 0; i < numOfToken; c++) 00494 { 00495 switch (*c) 00496 { 00497 case '\0': 00498 if (tokenC) 00499 { 00500 *tokenC = 0; 00501 vec[i++] = TypeTraits<ValueTypeT>::getFromString(token); 00502 00503 } 00504 00505 while (i < numOfToken) 00506 { 00507 vec[i++] = TypeTraits<ValueTypeT>::getZeroElement(); 00508 } 00509 00510 break; 00511 case ' ' : 00512 case '\t': 00513 case '\n': 00514 if (tokenC) 00515 { 00516 *tokenC = 0; 00517 vec[i++] = TypeTraits<ValueTypeT>::getFromString(token); 00518 tokenC = 0; 00519 } 00520 break; 00521 default: 00522 if (!tokenC) 00523 { 00524 tokenC = token; 00525 } 00526 *tokenC++ = *c; 00527 break; 00528 } 00529 } 00530 00531 _quat[0] = vec[0]; 00532 _quat[1] = vec[1]; 00533 _quat[2] = vec[2]; 00534 _quat[3] = vec[3]; 00535 }
|
|
||||||||||||||||||||
|
Definition at line 540 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::osgcos(), and osg::osgsin(). 00543 { 00544 ValueTypeT sx = osgsin(alpha * 0.5f); 00545 ValueTypeT cx = osgcos(alpha * 0.5f); 00546 00547 ValueTypeT sy = osgsin(beta * 0.5f); 00548 ValueTypeT cy = osgcos(beta * 0.5f); 00549 00550 ValueTypeT sz = osgsin(gamma * 0.5f); 00551 ValueTypeT cz = osgcos(gamma * 0.5f); 00552 00553 _quat[0] = (sx * cy * cz) - (cx * sy * sz); 00554 _quat[1] = (cx * sy * cz) + (sx * cy * sz); 00555 _quat[2] = (cx * cy * sz) - (sx * sy * cz); 00556 _quat[3] = (cx * cy * cz) + (sx * sy * sz); 00557 }
|
|
||||||||||
|
Definition at line 565 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat. 00566 { 00567 return _quat; 00568 }
|
|
||||||||||||||||||||||||
|
Definition at line 590 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat, osg::Eps, osg::osgacos(), osg::osgrad2degree(), and osg::QuaternionBase< ValueTypeT >::VectorType. Referenced by osg::ProjectionCameraDecorator::getProjectionTranslation(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisDeg(), and osg::QuaternionBase< ValueTypeT >::getValueAsAxisRad(). 00594 { 00595 ValueTypeT len; 00596 00597 VectorType q(_quat[0], _quat[1], _quat[2]); 00598 00599 len = q.length(); 00600 00601 if(len > Eps) 00602 { 00603 q *= (TypeTraits<ValueTypeT>::getOneElement() / len); 00604 00605 x = q[0]; 00606 y = q[1]; 00607 z = q[2]; 00608 00609 w = osgrad2degree(2.0f * osgacos(_quat[3])); 00610 } 00611 else 00612 { 00613 x = TypeTraits<ValueTypeT>::getZeroElement(); 00614 y = TypeTraits<ValueTypeT>::getZeroElement(); 00615 z = TypeTraits<ValueTypeT>::getOneElement(); 00616 00617 w = TypeTraits<ValueTypeT>::getZeroElement(); 00618 } 00619 }
|
|
||||||||||||||||||||||||
|
Definition at line 575 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::getValueAsAxisDeg(), and osg::osgdegree2rad(). Referenced by osg::Billboard::calcMatrix(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisRad(), osg::FieldDataTraits< Quaternion >::putToString(), osg::QuaternionBase< ValueTypeT >::scaleAngle(), and osg::VRMLWriteAction::writeTransformEnter(). 00579 { 00580 getValueAsAxisDeg(x, y, z, w); 00581 00582 w = osgdegree2rad(w); 00583 }
|
|
||||||||||||||||||||||||
|
Definition at line 624 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::_quat.
|
|
||||||||||||||||
|
Definition at line 638 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::getValueAsAxisRad(), osg::QuaternionBase< ValueTypeT >::w(), osg::QuaternionBase< ValueTypeT >::x(), osg::QuaternionBase< ValueTypeT >::y(), and osg::QuaternionBase< ValueTypeT >::z(). 00640 { 00641 ValueTypeT x; 00642 ValueTypeT y; 00643 ValueTypeT z; 00644 ValueTypeT w; 00645 00646 getValueAsAxisRad(x, y, z, w); 00647 00648 axis.setValues(x, y, z); 00649 00650 radians = w; 00651 }
|
|
||||||||||||||||
|
Definition at line 656 of file OSGQuaternion.inl. References osg::QuaternionBase< ValueTypeT >::getValueAsAxisDeg(), osg::QuaternionBase< ValueTypeT >::w(), osg::QuaternionBase< ValueTypeT >::x(), osg::QuaternionBase< ValueTypeT >::y(), and osg::QuaternionBase< ValueTypeT >::z(). 00658 { 00659 ValueTypeT x; 00660 ValueTypeT y; 00661 ValueTypeT z; 00662 ValueTypeT w; 00663 00664 getValueAsAxisDeg(x, y, z, w); 00665 00666 axis.setValues(x, y, z); 00667 00668 degrees = w; 00669 }
|
| |||||