![]() |
Orfeo Toolbox
3.16
|
A templated class holding a unit quaternion. More...
#include <itkVersor.h>
Inheritance diagram for itk::Versor< T >:
Collaboration diagram for itk::Versor< T >:Public Types | |
| typedef CovariantVector< T, 3 > | CovariantVectorType |
| typedef Matrix< T, 3, 3 > | MatrixType |
| typedef Point< T, 3 > | PointType |
| typedef NumericTraits < ValueType >::RealType | RealType |
| typedef Versor | Self |
| typedef T | ValueType |
| typedef Vector< T, 3 > | VectorType |
| typedef vnl_quaternion< T > | VnlQuaternionType |
| typedef vnl_vector_fixed< T, 3 > | VnlVectorType |
Public Member Functions | |
| Versor () | |
| Versor (const Self &v) | |
| Self | Exponential (ValueType exponent) const |
| ValueType | GetAngle (void) const |
| VectorType | GetAxis (void) const |
| Self | GetConjugate (void) const |
| MatrixType | GetMatrix (void) const |
| Self | GetReciprocal (void) const |
| VectorType | GetRight (void) const |
| ValueType | GetScalar (void) const |
| ValueType | GetTensor (void) const |
| vnl_quaternion< T > | GetVnlQuaternion (void) const |
| ValueType | GetW (void) const |
| ValueType | GetX (void) const |
| ValueType | GetY (void) const |
| ValueType | GetZ (void) const |
| void | Normalize (void) |
| bool | operator!= (const Self &vec) const |
| Self | operator* (const Self &vec) const |
| const Self & | operator*= (const Self &v) |
| Self | operator/ (const Self &vec) const |
| const Self & | operator/= (const Self &v) |
| const Self & | operator= (const Self &v) |
| bool | operator== (const Self &vec) const |
| void | Set (const VnlQuaternionType &) |
| void | Set (T x, T y, T z, T w) |
| void | Set (const VectorType &axis, ValueType angle) |
| void | Set (const MatrixType &m) |
| void | Set (const VectorType &axis) |
| void | SetIdentity () |
| void | SetRotationAroundX (ValueType angle) |
| void | SetRotationAroundY (ValueType angle) |
| void | SetRotationAroundZ (ValueType angle) |
| Self | SquareRoot (void) const |
| VectorType | Transform (const VectorType &v) const |
| CovariantVectorType | Transform (const CovariantVectorType &v) const |
| PointType | Transform (const PointType &v) const |
| VnlVectorType | Transform (const VnlVectorType &v) const |
Private Attributes | |
| ValueType | m_W |
| ValueType | m_X |
| ValueType | m_Y |
| ValueType | m_Z |
A templated class holding a unit quaternion.
Versor is a templated class that holds a unit quaternion. The difference between versors and quaternions is that quaternions can represent rotations and scale changes while versors are limited to rotations.
This class only implements the operations that maintain versors as a group, that is, any operations between versors result in another versor. For this reason, addition is not defined in this class, even though it is a valid operation between quaternions.
Definition at line 52 of file itkVersor.h.
| typedef CovariantVector<T,3> itk::Versor< T >::CovariantVectorType |
CovariantVector type.
Definition at line 72 of file itkVersor.h.
| typedef Matrix<T,3,3> itk::Versor< T >::MatrixType |
Type of the rotation matrix equivalent to the Versor
Definition at line 81 of file itkVersor.h.
| typedef Point<T,3> itk::Versor< T >::PointType |
Point type.
Definition at line 69 of file itkVersor.h.
| typedef NumericTraits<ValueType>::RealType itk::Versor< T >::RealType |
Type used for computations on the versor components
Definition at line 63 of file itkVersor.h.
| typedef Versor itk::Versor< T >::Self |
Standard class typedefs.
Definition at line 56 of file itkVersor.h.
| typedef T itk::Versor< T >::ValueType |
ValueType can be used to declare a variable that is the same type as a data element held in a Versor.
Definition at line 60 of file itkVersor.h.
| typedef Vector<T,3> itk::Versor< T >::VectorType |
Vector type used to represent the axis.
Definition at line 66 of file itkVersor.h.
| typedef vnl_quaternion<T> itk::Versor< T >::VnlQuaternionType |
Vnl Quaternion type.
Definition at line 78 of file itkVersor.h.
| typedef vnl_vector_fixed<T,3> itk::Versor< T >::VnlVectorType |
Vnl Vector type.
Definition at line 75 of file itkVersor.h.
| itk::Versor< T >::Versor | ( | ) |
Default constructor creates a null versor (representing 0 degrees rotation).
Constructor to initialize entire vector to one value.
Definition at line 33 of file itkVersor.txx.
| itk::Versor< T >::Versor | ( | const Self & | v | ) |
Copy constructor.
Copy Constructor
Definition at line 44 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| Versor< T > itk::Versor< T >::Exponential | ( | ValueType | exponent | ) | const |
Compute the Exponential of the unit quaternion Exponentiation by a factor is equivalent to multiplication of the rotaion angle of the quaternion.
Compute the Exponential of the quaternion
Definition at line 354 of file itkVersor.txx.
References itk::Versor< T >::Set().
| Versor< T >::ValueType itk::Versor< T >::GetAngle | ( | void | ) | const |
Returns the rotation angle in radians.
Get Angle (in radians)
Definition at line 316 of file itkVersor.txx.
| Versor< T >::VectorType itk::Versor< T >::GetAxis | ( | void | ) | const |
Returns the axis of the rotation. It is a unit vector parallel to the axis.
Get Axis
Definition at line 262 of file itkVersor.txx.
| Versor< T > itk::Versor< T >::GetConjugate | ( | void | ) | const |
Get Conjugate versor. Returns the versor that produce a rotation by the same angle but in opposite direction.
Get Conjugate
Definition at line 193 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| Matrix< T, 3, 3 > itk::Versor< T >::GetMatrix | ( | void | ) | const |
Get the matrix representation.
Get Matrix representation
Definition at line 710 of file itkVersor.txx.
Referenced by itk::Rigid3DPerspectiveTransform< TScalarType >::Rigid3DPerspectiveTransform(), and itk::Rigid3DPerspectiveTransform< TScalarType >::SetRotation().
| Versor< T > itk::Versor< T >::GetReciprocal | ( | void | ) | const |
Get Reciprocal versor. Returns the versor that composed with this one will result in a scalar operator equals to 1. It is also equivalent to 1/this.
Get Reciprocal
Definition at line 209 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
Referenced by itk::Versor< T >::operator==().
| Versor< T >::VectorType itk::Versor< T >::GetRight | ( | void | ) | const |
Returns the Right part It is a vector part of the Versor. It is called Right because it is equivalent to a right angle rotation.
Get Right part
Definition at line 292 of file itkVersor.txx.
| Versor< T >::ValueType itk::Versor< T >::GetScalar | ( | void | ) | const |
| Versor< T >::ValueType itk::Versor< T >::GetTensor | ( | void | ) | const |
Get Tensor part of the Versor. Given that Versors are normalized quaternions this value is expected to be 1.0 always
Get Tensor part
Definition at line 225 of file itkVersor.txx.
| vnl_quaternion< T > itk::Versor< T >::GetVnlQuaternion | ( | void | ) | const |
Get a vnl_quaternion with a copy of the internal memory block.
Return a vnl_quaternion
Definition at line 81 of file itkVersor.txx.
|
inline |
Returns the W component.
Definition at line 184 of file itkVersor.h.
Referenced by itk::operator<<().
|
inline |
Returns the X component.
Definition at line 172 of file itkVersor.h.
Referenced by itk::operator<<(), itk::VersorTransformOptimizer::StepAlongGradient(), and itk::VersorRigid3DTransformOptimizer::StepAlongGradient().
|
inline |
Returns the Y component.
Definition at line 176 of file itkVersor.h.
Referenced by itk::operator<<(), itk::VersorTransformOptimizer::StepAlongGradient(), and itk::VersorRigid3DTransformOptimizer::StepAlongGradient().
|
inline |
Returns the Z component.
Definition at line 180 of file itkVersor.h.
Referenced by itk::operator<<(), itk::VersorTransformOptimizer::StepAlongGradient(), and itk::VersorRigid3DTransformOptimizer::StepAlongGradient().
| void itk::Versor< T >::Normalize | ( | void | ) |
Normalize the Versor. Given that Versors are normalized quaternions this method is provided only for convinience when it is suspected that a versor could be out of the unit sphere.
Normalize
Definition at line 239 of file itkVersor.txx.
References itk::ExceptionObject::SetDescription(), and itk::ExceptionObject::SetLocation().
| bool itk::Versor< T >::operator!= | ( | const Self & | v | ) | const |
Versor operator!= Performs the comparison between two versors. this operation uses an arbitrary threshold for the comparison.
Comparision operator
Definition at line 161 of file itkVersor.txx.
| Versor< T > itk::Versor< T >::operator* | ( | const Self & | v | ) | const |
Versor operator*. Performs the composition of two versors. this operation is NOT commutative.
Composition Operator
Definition at line 109 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| const Versor< T > & itk::Versor< T >::operator*= | ( | const Self & | v | ) |
Composition operator *=. Compose the current versor with the operand and store the result in the current versor.
Assignment and Composition Operator
Definition at line 90 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| Versor< T > itk::Versor< T >::operator/ | ( | const Self & | v | ) | const |
Versor operator/. Performs the division of two versors.
Division Operator
Definition at line 145 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| const Versor< T > & itk::Versor< T >::operator/= | ( | const Self & | v | ) |
Division operator /=. Divide the current versor with the operand and store the result in the current versor. This is equivalent to compose the Versor with the reciprocal of the operand
Division and Assignment Operator
Definition at line 126 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| const Versor< T > & itk::Versor< T >::operator= | ( | const Self & | v | ) |
Assignment operator =. Copy the versor argument.
Assignment Operator
Definition at line 56 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| bool itk::Versor< T >::operator== | ( | const Self & | v | ) | const |
Versor operator== Performs the comparison between two versors. this operation uses an arbitrary threshold for the comparison.
Comparision operator
Definition at line 170 of file itkVersor.txx.
References itk::Versor< T >::GetReciprocal(), and itk::Versor< T >::m_W.
| void itk::Versor< T >::Set | ( | const VnlQuaternionType & | quaternion | ) |
Set the Versor from a Quaternion
Set from a vnl_quaternion After assignment, the quaternion is normalized in order to get a consistent Versor (unit quaternion).
Definition at line 510 of file itkVersor.txx.
Referenced by itk::Versor< T >::Exponential(), itk::Rigid3DPerspectiveTransform< TScalarType >::SetRotation(), itk::VersorTransformOptimizer::StepAlongGradient(), and itk::VersorRigid3DTransformOptimizer::StepAlongGradient().
| void itk::Versor< T >::Set | ( | T | x, |
| T | y, | ||
| T | z, | ||
| T | w | ||
| ) |
Set the Versor from Quaternion components.
, is represented by
in the (x,y,z) components and by
in the "w" component. The rotation by any
should be equivalent to a rotation by
, therefore we should be able to replace
with
and
with
. Considering that
we can conclude that if we simultaneously change the signs of all the Versor components, the rotation that it represents remains unchanged.Set the Versor from four components. After assignment, the quaternion is normalized in order to get a consistent Versor (unit quaternion).
Definition at line 478 of file itkVersor.txx.
| void itk::Versor< T >::Set | ( | const VectorType & | axis, |
| ValueType | angle | ||
| ) |
Set the versor using a vector and angle the unit vector parallel to the given vector will be used. The angle is expected in radians.
Set Axis and Angle (in radians)
Definition at line 368 of file itkVersor.txx.
References itk::Vector< T, NVectorDimension >::GetNorm().
| void itk::Versor< T >::Set | ( | const MatrixType & | mat | ) |
Set the versor using an orthogonal matrix. Based on code from: http://www.euclideanspace.com/maths/geometry/rotations/ conversions/matrixToQuaternion/index.htm
Set using an orthogonal matrix.
Definition at line 388 of file itkVersor.txx.
References itk::Matrix< T, NRows, NColumns >::GetVnlMatrix().
| void itk::Versor< T >::Set | ( | const VectorType & | axis | ) |
Set the versor using the right part. the magnitude of the vector given is assumed to be equal to vcl_sin(angle/2). This method will compute internally the scalar part that preserve the Versor as a unit quaternion.
Set right Part (in radians)
Definition at line 449 of file itkVersor.txx.
References itk::Vector< T, NVectorDimension >::GetNorm(), itk::ExceptionObject::SetDescription(), and itk::ExceptionObject::SetLocation().
| void itk::Versor< T >::SetIdentity | ( | void | ) |
Reset the values so the versor is equivalent to an identity transformation. This is equivalent to set a zero angle
Set to an identity transform
Definition at line 69 of file itkVersor.txx.
Referenced by itk::Rigid3DPerspectiveTransform< TScalarType >::Rigid3DPerspectiveTransform(), and itk::VersorTransform< TScalarType >::VersorTransform().
| void itk::Versor< T >::SetRotationAroundX | ( | ValueType | angle | ) |
Sets a rotation around the X axis using the parameter as angle in radians. This is a method provided for convinience to initialize a rotation. The effect of this methods is not cumulative with any value previously stored in the Versor.
Set rotation around X axis
Definition at line 523 of file itkVersor.txx.
| void itk::Versor< T >::SetRotationAroundY | ( | ValueType | angle | ) |
Sets a rotation around the Y axis using the parameter as angle in radians. This is a method provided for convinience to initialize a rotation. The effect of this methods is not cumulative with any value previously stored in the Versor.
Set rotation around Y axis
Definition at line 538 of file itkVersor.txx.
| void itk::Versor< T >::SetRotationAroundZ | ( | ValueType | angle | ) |
Sets a rotation around the Y axis using the parameter as angle in radians. This is a method provided for convinience to initialize a rotation. The effect of this methods is not cumulative with any value previously stored in the Versor.
Set rotation around Z axis
Definition at line 553 of file itkVersor.txx.
| Versor< T > itk::Versor< T >::SquareRoot | ( | void | ) | const |
Get the Square root of the unit quaternion.
Get the Square root of the unit quaternion
Definition at line 333 of file itkVersor.txx.
References itk::Versor< T >::m_W, itk::Versor< T >::m_X, itk::Versor< T >::m_Y, and itk::Versor< T >::m_Z.
| Versor< T >::VectorType itk::Versor< T >::Transform | ( | const VectorType & | v | ) | const |
| Versor< T >::CovariantVectorType itk::Versor< T >::Transform | ( | const CovariantVectorType & | v | ) | const |
Transform a covariant vector.
Transform a CovariantVector given that this is an orthogonal transformation CovariantVectors are transformed as vectors.
Definition at line 605 of file itkVersor.txx.
| Versor< T >::PointType itk::Versor< T >::Transform | ( | const PointType & | v | ) | const |
| Versor< T >::VnlVectorType itk::Versor< T >::Transform | ( | const VnlVectorType & | v | ) | const |
|
private |
Escalar component of the Versor.
Definition at line 281 of file itkVersor.h.
Referenced by itk::Versor< T >::GetConjugate(), itk::Versor< T >::GetReciprocal(), itk::Versor< TScalarType >::GetW(), itk::Versor< T >::operator*(), itk::Versor< T >::operator*=(), itk::Versor< T >::operator/(), itk::Versor< T >::operator/=(), itk::Versor< T >::operator=(), itk::Versor< T >::operator==(), itk::Versor< T >::SquareRoot(), and itk::Versor< T >::Versor().
|
private |
Component parallel to x axis.
Definition at line 272 of file itkVersor.h.
Referenced by itk::Versor< T >::GetConjugate(), itk::Versor< T >::GetReciprocal(), itk::Versor< TScalarType >::GetX(), itk::Versor< T >::operator*(), itk::Versor< T >::operator*=(), itk::Versor< T >::operator/(), itk::Versor< T >::operator/=(), itk::Versor< T >::operator=(), itk::Versor< T >::SquareRoot(), and itk::Versor< T >::Versor().
|
private |
Component parallel to y axis.
Definition at line 275 of file itkVersor.h.
Referenced by itk::Versor< T >::GetConjugate(), itk::Versor< T >::GetReciprocal(), itk::Versor< TScalarType >::GetY(), itk::Versor< T >::operator*(), itk::Versor< T >::operator*=(), itk::Versor< T >::operator/(), itk::Versor< T >::operator/=(), itk::Versor< T >::operator=(), itk::Versor< T >::SquareRoot(), and itk::Versor< T >::Versor().
|
private |
Component parallel to z axis.
Definition at line 278 of file itkVersor.h.
Referenced by itk::Versor< T >::GetConjugate(), itk::Versor< T >::GetReciprocal(), itk::Versor< TScalarType >::GetZ(), itk::Versor< T >::operator*(), itk::Versor< T >::operator*=(), itk::Versor< T >::operator/(), itk::Versor< T >::operator/=(), itk::Versor< T >::operator=(), itk::Versor< T >::SquareRoot(), and itk::Versor< T >::Versor().