#include <Quater.h>

Public Member Functions | |
| Quater () | |
| virtual | ~Quater () |
| Quater (Real x, Real y, Real z, Real w) | |
| template<class Real2 > | |
| Quater (const Real2 q[]) | |
| template<class Real2 > | |
| Quater (const Quater< Real2 > &q) | |
| Quater (const defaulttype::Vec< 3, Real > &axis, Real angle) | |
| const Real * | ptr () const |
| Cast into a standard C array of elements. | |
| Real * | ptr () |
| Cast into a standard C array of elements. | |
| void | normalize () |
| Normalize a quaternion. | |
| void | clear () |
| void | fromMatrix (const defaulttype::Matrix3 &m) |
| template<class Mat33 > | |
| void | toMatrix (Mat33 &m) const |
| template<class Vec > | |
| Vec | rotate (const Vec &v) const |
| Apply the rotation to a given vector. | |
| template<class Vec > | |
| Vec | inverseRotate (const Vec &v) const |
| Apply the inverse rotation to a given vector. | |
| Quater< Real > | operator+ (const Quater< Real > &q1) const |
| Given two quaternions, add them together to get a third quaternion. | |
| Quater< Real > | operator* (const Quater< Real > &q1) const |
| Quater< Real > | operator* (const Real &r) const |
| Quater | quatVectMult (const defaulttype::Vec< 3, Real > &vect) |
| Given two Quaters, multiply them together to get a third quaternion. | |
| Quater | vectQuatMult (const defaulttype::Vec< 3, Real > &vect) |
| Real & | operator[] (int index) |
| const Real & | operator[] (int index) const |
| Quater | inverse () const |
| defaulttype::Vec< 3, Real > | toEulerVector () const |
| void | buildRotationMatrix (Real m[4][4]) const |
| Build a rotation matrix, given a quaternion rotation. | |
| void | writeOpenGlMatrix (double *m) const |
| Write an OpenGL rotation matrix. | |
| void | writeOpenGlMatrix (float *m) const |
| Write an OpenGL rotation matrix. | |
| Quater | axisToQuat (defaulttype::Vec< 3, Real > a, Real phi) |
| Given an axis and angle, compute quaternion. | |
| void | print () |
| Print quaternion (C style). | |
| void | operator+= (const Quater &q2) |
| void | operator*= (const Quater &q2) |
Static Public Member Functions | |
| static Quater | identity () |
| template<class V > | |
| static Quater | createFromRotationVector (const V &a) |
| Create using rotation vector (axis*angle) given in parent coordinates. | |
| static Quater | createQuaterFromEuler (defaulttype::Vec< 3, Real > v) |
| Create a quaternion from Euler. | |
| template<class T > | |
| static Quater | createFromRotationVector (T a0, T a1, T a2) |
| Create using the entries of a rotation vector (axis*angle) given in parent coordinates. | |
| template<class V > | |
| static Quater | set (const V &a) |
| Create using rotation vector (axis*angle) given in parent coordinates. | |
| template<class T > | |
| static Quater | set (T a0, T a1, T a2) |
| Create using using the entries of a rotation vector (axis*angle) given in parent coordinates. | |
| static unsigned int | size () |
Private Attributes | |
| Real | _q [4] |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Quater &v) |
| write to an output stream | |
| std::istream & | operator>> (std::istream &in, Quater &v) |
| read from an input stream | |
Definition at line 43 of file Quater.h.
| sofa::helper::Quater< Real >::Quater | ( | ) | [inline] |
Definition at line 45 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
Referenced by sofa::helper::Quater< DataTypes::Real >::createFromRotationVector(), and sofa::helper::Quater< DataTypes::Real >::identity().
| sofa::helper::Quater< Real >::~Quater | ( | ) | [inline, virtual] |
Definition at line 67 of file Quater.inl.
| sofa::helper::Quater< Real >::Quater | ( | Real | x, | |
| Real | y, | |||
| Real | z, | |||
| Real | w | |||
| ) | [inline] |
| sofa::helper::Quater< Real >::Quater | ( | const Real2 | q[] | ) | [inline] |
| sofa::helper::Quater< Real >::Quater | ( | const Quater< Real2 > & | q | ) | [inline] |
| sofa::helper::Quater< Real >::Quater | ( | const defaulttype::Vec< 3, Real > & | axis, | |
| Real | angle | |||
| ) | [inline] |
| Quater< Real > sofa::helper::Quater< Real >::axisToQuat | ( | defaulttype::Vec< 3, Real > | a, | |
| Real | phi | |||
| ) | [inline] |
Given an axis and angle, compute quaternion.
Definition at line 411 of file Quater.inl.
References sofa::helper::Quater< Real >::_q, sofa::defaulttype::Vec< N, real >::norm(), sofa::defaulttype::Vec< N, real >::x(), sofa::defaulttype::Vec< N, real >::y(), and sofa::defaulttype::Vec< N, real >::z().
Referenced by sofa::component::mapping::ArticulatedSystemMapping< BasicMapping >::apply(), sofa::helper::gl::Trackball::ComputeQuaternion(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::initLarge(), sofa::gpu::cuda::CudaRigidTypes< 3, real >::interpolate(), sofa::defaulttype::StdRigidTypes< 3, real >::interpolate(), and sofa::helper::Quater< Real >::Quater().
| void sofa::helper::Quater< Real >::buildRotationMatrix | ( | Real | m[4][4] | ) | const [inline] |
Build a rotation matrix, given a quaternion rotation.
Definition at line 312 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
Referenced by sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::draw(), and sofa::gui::glut::SimpleGUI::DrawScene().
| void sofa::helper::Quater< Real >::clear | ( | ) | [inline] |
Definition at line 78 of file Quater.h.
Referenced by sofa::defaulttype::SolidTypes< R >::Transform::clear(), sofa::defaulttype::LaparoscopicRigid3Types::Coord::clear(), and sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::InteractionEllipsoidForceField().
| static Quater sofa::helper::Quater< Real >::createFromRotationVector | ( | T | a0, | |
| T | a1, | |||
| T | a2 | |||
| ) | [inline, static] |
| static Quater sofa::helper::Quater< Real >::createFromRotationVector | ( | const V & | a | ) | [inline, static] |
Create using rotation vector (axis*angle) given in parent coordinates.
Definition at line 181 of file Quater.h.
Referenced by sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringForce(), sofa::component::contextobject::CoordinateSystem::reinit(), sofa::helper::Quater< DataTypes::Real >::set(), sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::setInitOrientation(), and sofa::defaulttype::SolidTypes< R >::Transform::Transform().
| static Quater sofa::helper::Quater< Real >::createQuaterFromEuler | ( | defaulttype::Vec< 3, Real > | v | ) | [inline, static] |
| void sofa::helper::Quater< Real >::fromMatrix | ( | const defaulttype::Matrix3 & | m | ) | [inline] |
Definition at line 234 of file Quater.inl.
References sofa::helper::Quater< Real >::_q, sofa::defaulttype::Mat< L, C, real >::x(), sofa::defaulttype::Mat< L, C, real >::y(), and sofa::defaulttype::Mat< L, C, real >::z().
Referenced by applyForceCallback(), sofa::component::constraint::ParabolicConstraint< DataTypes >::init(), sofa::gui::glut::SimpleGUI::mouseEvent(), sofa::gui::qt::viewer::qtogre::QtOgreViewer::moveRayPickInteractor(), sofa::gui::qt::viewer::qt::QtViewer::moveRayPickInteractor(), sofa::gui::qt::viewer::qgl::QtGLViewer::moveRayPickInteractor(), sofa::component::controller::stateCallback(), and SensAble::updatePosition().
| static Quater sofa::helper::Quater< Real >::identity | ( | ) | [inline, static] |
Definition at line 58 of file Quater.h.
Referenced by sofa::defaulttype::SolidTypes< R >::Transform::identity().
| Quater< Real > sofa::helper::Quater< Real >::inverse | ( | ) | const [inline] |
Definition at line 185 of file Quater.inl.
References sofa::helper::Quater< Real >::_q, and norm().
Referenced by sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringForce(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::init(), sofa::defaulttype::SolidTypes< R >::Transform::inversed(), sofa::defaulttype::RigidCoord< 3, real >::operator-(), sofa::component::forcefield::qDiff(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::rotateConstraints(), and sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::rotateResponse().
| Vec sofa::helper::Quater< Real >::inverseRotate | ( | const Vec & | v | ) | const [inline] |
Apply the inverse rotation to a given vector.
Definition at line 118 of file Quater.h.
Referenced by sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addDForce(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addForce(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addForce2(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::applyStiffnessLarge(), sofa::defaulttype::SolidTypes< R >::Transform::backProjectPoint(), sofa::defaulttype::SolidTypes< R >::Transform::backProjectVector(), sofa::component::constraint::ParabolicConstraint< DataTypes >::init(), sofa::defaulttype::SolidTypes< R >::Transform::operator*(), sofa::defaulttype::SolidTypes< R >::Transform::operator*=(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::rotateConstraints(), sofa::defaulttype::SolidTypes< R >::Transform::set(), sofa::defaulttype::SolidTypes< R >::Transform::setOrigin(), sofa::defaulttype::SolidTypes< R >::Transform::Transform(), and sofa::defaulttype::LaparoscopicRigid3Types::Coord::vectorToChild().
| void sofa::helper::Quater< Real >::normalize | ( | ) | [inline] |
Normalize a quaternion.
Quater<Real>s always obey: a^2 + b^2 + c^2 + d^2 = 1.0 If they don't add up to 1.0, dividing by their magnitude will renormalize them.
Definition at line 218 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
Referenced by sofa::gui::glut::SimpleGUI::ApplyMouseInteractorTransformation(), copyDeviceDataCallback(), sofa::component::controller::OmniDriver::handleEvent(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::init(), sofa::component::constraint::ParabolicConstraint< DataTypes >::init(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::initLarge(), sofa::gpu::cuda::CudaRigidTypes< 3, real >::interpolate(), sofa::defaulttype::StdRigidTypes< 3, real >::interpolate(), sofa::helper::Quater< Real >::operator+(), sofa::defaulttype::LaparoscopicRigid3Types::Coord::operator+(), sofa::defaulttype::SolidTypes< R >::Transform::operator+=(), sofa::defaulttype::RigidCoord< 3, real >::operator+=(), sofa::defaulttype::LaparoscopicRigid3Types::Coord::operator+=(), sofa::component::mass::UniformMass< DataTypes, MassType >::parse(), SensAble::reinit(), sofa::gui::qt::viewer::qgl::QtGLViewer::resetView(), SensAble::SensAble(), sofa::component::controller::stateCallback(), sofa::gui::glut::SimpleGUI::SwitchToPresetView(), and sofa::helper::Quater< Real >::toEulerVector().
| Quater< Real > sofa::helper::Quater< Real >::operator* | ( | const Real & | r | ) | const [inline] |
| Quater< Real > sofa::helper::Quater< Real >::operator* | ( | const Quater< Real > & | q1 | ) | const [inline] |
| void sofa::helper::Quater< Real >::operator*= | ( | const Quater< Real > & | q2 | ) |
| Quater< Real > sofa::helper::Quater< Real >::operator+ | ( | const Quater< Real > & | q1 | ) | const [inline] |
Given two quaternions, add them together to get a third quaternion.
Given two rotations, e1 and e2, expressed as quaternion rotations, figure out the equivalent single rotation and stuff it into dest.
Adding quaternions to get a compound rotation is analagous to adding translations to get a compound translation.
This routine also normalizes the result every RENORMCOUNT times it is called, to keep error from creeping in. NOTE: This routine is written so that q1 or q2 may be the same as dest (or each other).
Definition at line 79 of file Quater.inl.
References sofa::helper::Quater< Real >::_q, sofa::helper::Quater< Real >::normalize(), and RENORMCOUNT.
| void sofa::helper::Quater< Real >::operator+= | ( | const Quater< Real > & | q2 | ) |
| const Real& sofa::helper::Quater< Real >::operator[] | ( | int | index | ) | const [inline] |
| Real& sofa::helper::Quater< Real >::operator[] | ( | int | index | ) | [inline] |
| void sofa::helper::Quater< Real >::print | ( | ) | [inline] |
Print quaternion (C style).
Definition at line 456 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
| Real* sofa::helper::Quater< Real >::ptr | ( | ) | [inline] |
| const Real* sofa::helper::Quater< Real >::ptr | ( | ) | const [inline] |
| Quater< Real > sofa::helper::Quater< Real >::quatVectMult | ( | const defaulttype::Vec< 3, Real > & | vect | ) | [inline] |
Given two Quaters, multiply them together to get a third quaternion.
Definition at line 159 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
Referenced by sofa::gui::glut::SimpleGUI::ApplyMouseInteractorTransformation().
| Vec sofa::helper::Quater< Real >::rotate | ( | const Vec & | v | ) | const [inline] |
Apply the rotation to a given vector.
Definition at line 106 of file Quater.h.
Referenced by sofa::component::visualmodel::VisualModelImpl::addBBox(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addDForce(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addForce(), sofa::component::forcefield::ConicalForceField< DataTypes >::addForce(), sofa::component::interactionforcefield::InteractionEllipsoidForceField< DataTypes1, DataTypes2 >::addForce2(), sofa::component::mapping::ArticulatedSystemMapping< BasicMapping >::apply(), sofa::component::controller::MechanicalStateController< DataTypes >::applyController(), sofa::component::controller::EdgeSetController< DataTypes >::applyController(), sofa::component::mapping::LaparoscopicRigidMapping< BasicMapping >::applyJ(), sofa::component::mapping::LaparoscopicRigidMapping< BasicMapping >::applyJT(), sofa::component::visualmodel::VisualModelImpl::applyRotation(), sofa::component::MechanicalObject< DataTypes >::applyRotation(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::applyStiffnessLarge(), sofa::component::constraint::AttachConstraint< DataTypes >::calcRestRotations(), sofa::component::MechanicalObject< DataTypes >::computeNewPoint(), sofa::component::mapping::computeOrientation(), sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::correctPosChild(), sofa::component::forcefield::BeamFEMForceField< DataTypes >::draw(), sofa::component::constraint::ParabolicConstraint< DataTypes >::draw(), sofa::defaulttype::SolidTypes< R >::Transform::getOrigin(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::init(), sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::initTranslateChild(), sofa::defaulttype::SolidTypes< R >::Transform::inversed(), sofa::defaulttype::SolidTypes< R >::Transform::operator*(), sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::posOnChildGlobal(), sofa::defaulttype::SolidTypes< R >::Transform::projectPoint(), sofa::component::constraint::ParabolicConstraint< DataTypes >::projectPosition(), sofa::defaulttype::SolidTypes< R >::Transform::projectVector(), sofa::component::constraint::ParabolicConstraint< DataTypes >::projectVelocity(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::rotateResponse(), and sofa::component::container::ArticulatedHierarchyContainer::ArticulationCenter::translateChild().
| static Quater sofa::helper::Quater< Real >::set | ( | T | a0, | |
| T | a1, | |||
| T | a2 | |||
| ) | [inline, static] |
| static Quater sofa::helper::Quater< Real >::set | ( | const V & | a | ) | [inline, static] |
| static unsigned int sofa::helper::Quater< Real >::size | ( | void | ) | [inline, static] |
| defaulttype::Vec< 3, Real > sofa::helper::Quater< Real >::toEulerVector | ( | ) | const [inline] |
Definition at line 428 of file Quater.inl.
References sofa::helper::Quater< Real >::_q, norm(), sofa::helper::Quater< Real >::normalize(), sofa::defaulttype::Vec< N, real >::x(), sofa::defaulttype::Vec< N, real >::y(), and sofa::defaulttype::Vec< N, real >::z().
Referenced by sofa::component::forcefield::BeamFEMForceField< DataTypes >::accumulateForceLarge(), sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringForce(), sofa::component::constraint::PrecomputedConstraintCorrection< TDataTypes >::init(), and sofa::component::forcefield::BeamFEMForceField< DataTypes >::initLarge().
| void sofa::helper::Quater< Real >::toMatrix | ( | Mat33 & | m | ) | const [inline] |
Definition at line 89 of file Quater.h.
Referenced by sofa::component::forcefield::BeamFEMForceField< DataTypes >::addKToMatrix(), sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringForce(), sofa::component::mapping::SkinningMapping< BasicMapping >::apply(), sofa::component::controller::OmniDriver::init(), SensAble::reinit(), SofaFlowVR::FlowVRRenderMesh::renderUpdate(), SensAble::SensAble(), sofa::defaulttype::Frame::setTransform(), and SensAble::updatePosition().
| Quater< Real > sofa::helper::Quater< Real >::vectQuatMult | ( | const defaulttype::Vec< 3, Real > & | vect | ) | [inline] |
Definition at line 172 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
Referenced by sofa::defaulttype::LaparoscopicRigid3Types::Coord::operator+(), and sofa::defaulttype::LaparoscopicRigid3Types::Coord::operator+=().
| void sofa::helper::Quater< Real >::writeOpenGlMatrix | ( | float * | m | ) | const [inline] |
Write an OpenGL rotation matrix.
Definition at line 386 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
| void sofa::helper::Quater< Real >::writeOpenGlMatrix | ( | double * | m | ) | const [inline] |
Write an OpenGL rotation matrix.
Write an OpenGL rotation matrix
Definition at line 361 of file Quater.inl.
References sofa::helper::Quater< Real >::_q.
Referenced by sofa::helper::gl::Cylinder::update(), sofa::helper::gl::Axis::update(), and sofa::defaulttype::SolidTypes< R >::Transform::writeOpenGlMatrix().
| std::ostream& operator<< | ( | std::ostream & | out, | |
| const Quater< Real > & | v | |||
| ) | [friend] |
| std::istream& operator>> | ( | std::istream & | in, | |
| Quater< Real > & | v | |||
| ) | [friend] |
Real sofa::helper::Quater< Real >::_q[4] [private] |
Definition at line 46 of file Quater.h.
Referenced by sofa::helper::Quater< Real >::axisToQuat(), sofa::helper::Quater< Real >::buildRotationMatrix(), sofa::helper::Quater< DataTypes::Real >::clear(), sofa::helper::Quater< Real >::fromMatrix(), sofa::helper::Quater< Real >::inverse(), sofa::helper::Quater< DataTypes::Real >::inverseRotate(), sofa::helper::Quater< Real >::normalize(), sofa::helper::Quater< Real >::operator*(), sofa::helper::Quater< Real >::operator+(), sofa::helper::Quater< DataTypes::Real >::operator[](), sofa::helper::Quater< Real >::print(), sofa::helper::Quater< DataTypes::Real >::ptr(), sofa::helper::Quater< Real >::Quater(), sofa::helper::Quater< DataTypes::Real >::Quater(), sofa::helper::Quater< Real >::quatVectMult(), sofa::helper::Quater< DataTypes::Real >::rotate(), sofa::helper::Quater< Real >::toEulerVector(), sofa::helper::Quater< DataTypes::Real >::toMatrix(), sofa::helper::Quater< Real >::vectQuatMult(), and sofa::helper::Quater< Real >::writeOpenGlMatrix().
1.5.7.1