Templates -- Meow  1.1.2
不能,也不應該先編譯成obj-file的templates
meow::Rotation3D< Scalar > Class Template Reference

Rotation a point/vector alone an axis with given angle in 3D world. More...

#include "LinearTransformations.h"

Inheritance diagram for meow::Rotation3D< Scalar >:
meow::LinearTransformation< Scalar > meow::Transformation< Scalar >

Public Member Functions

 Rotation3D ()
 
 Rotation3D (Rotation3D const &b)
 
 ~Rotation3D ()
 
Rotation3DcopyFrom (Rotation3D const &b)
 Copy data. More...
 
Rotation3DreferenceFrom (Rotation3D const &b)
 Reference data. More...
 
Scalar parameter (size_t i) const
 same as theta(i) More...
 
Scalar parameter (size_t i, Scalar const &s)
 same as theta(i, s) More...
 
Scalar const & theta (size_t i) const
 Get the i -th theta. More...
 
Scalar const & theta (size_t i, Scalar const &s)
 Set the i -th theta. More...
 
void axisAngle (Vector< Scalar > const &axis, Scalar const &angle)
 Setting. More...
 
Rotation3Dadd (Rotation3D const &r)
 Concat another rotation transformation. More...
 
Matrix< Scalar > transformate (Matrix< Scalar > const &x) const
 Do the transformate. More...
 
Matrix< Scalar > jacobian (Matrix< Scalar > const &x) const
 Return the jacobian matrix (derivate by the input vector) of this transformate. More...
 
Matrix< Scalar > jacobian (Matrix< Scalar > const &x, size_t i) const
 Return the jacobian matrix of this transformate. More...
 
Matrix< Scalar > transformateInv (Matrix< Scalar > const &x) const
 Do the inverse transformate. More...
 
Matrix< Scalar > jacobianInv (Matrix< Scalar > const &x) const
 Return the jacobian matrix of the inverse form of this transformate. More...
 
Matrix< Scalar > jacobianInv (Matrix< Scalar > const &x, size_t i) const
 Return the jacobian matrix of the inverse form of this transformate. More...
 
Matrix< Scalar > matrixInv () const
 Return the inverse matrix. More...
 
Rotation3Doperator= (Rotation3D const &b)
 same as copyFrom(b) More...
 
- Public Member Functions inherited from meow::LinearTransformation< Scalar >
virtual ~LinearTransformation ()
 
virtual Matrix< Scalar > const & matrix () const
 Return the matrix form of this transformation. More...
 
- Public Member Functions inherited from meow::Transformation< Scalar >
virtual ~Transformation ()
 
size_t inputRows () const
 Return the number of rows of the input matrix. More...
 
size_t inputCols () const
 Return the number of columns of the input matrix. More...
 
size_t outputRows () const
 Return the number of rows of the output matrix. More...
 
size_t outputCols () const
 Return the number of columns of the output matrix. More...
 
size_t parameterSize () const
 Return the number of parameters. More...
 
virtual bool inversable () const
 Return whether this transformation is inversable or not. More...
 

Additional Inherited Members

- Protected Member Functions inherited from meow::LinearTransformation< Scalar >
 LinearTransformation (size_t inputRows, size_t outputRows, size_t psize)
 
 LinearTransformation (size_t inputRows, size_t outputRows, size_t psize, Matrix< Scalar > const &m)
 
 LinearTransformation (LinearTransformation const &b)
 
LinearTransformationcopyFrom (LinearTransformation const &b)
 Copy settings, matrix from another LinearTransformation. More...
 
LinearTransformationreferenceFrom (LinearTransformation const &b)
 Reference settings, matrix from another LinearTransformation. More...
 
Matrix< Scalar > const & matrix (Matrix< Scalar > const &m)
 Setup the matrix. More...
 

Detailed Description

template<class Scalar>
class meow::Rotation3D< Scalar >

Rotation a point/vector alone an axis with given angle in 3D world.

Author
cat_leopard

Constructor & Destructor Documentation

template<class Scalar>
meow::Rotation3D< Scalar >::Rotation3D ( )
inline

Constructor with no rotation

template<class Scalar>
meow::Rotation3D< Scalar >::Rotation3D ( Rotation3D< Scalar > const &  b)
inline

Constructor and copy data

template<class Scalar>
meow::Rotation3D< Scalar >::~Rotation3D ( )
inline

Destructor

Member Function Documentation

template<class Scalar>
Rotation3D& meow::Rotation3D< Scalar >::add ( Rotation3D< Scalar > const &  r)
inline

Concat another rotation transformation.

Parameters
[in]ranother rotation transformation
template<class Scalar>
void meow::Rotation3D< Scalar >::axisAngle ( Vector< Scalar > const &  axis,
Scalar const &  angle 
)
inline

Setting.

Parameters
[in]axisaxis
[in]angleangle
template<class Scalar>
Rotation3D& meow::Rotation3D< Scalar >::copyFrom ( Rotation3D< Scalar > const &  b)
inline

Copy data.

Parameters
[in]banother Rotation3D class.
Returns
*this
template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::jacobian ( Matrix< Scalar > const &  x) const
inlinevirtual

Return the jacobian matrix (derivate by the input vector) of this transformate.

The matrix we return is:

\[ \left[ \begin{array}{ccc} 2(n_x^2 - 1) \sin^2\phi + 1 & 2n_x n_y \sin^2\phi - 2n_z\cos \phi\sin \phi & 2n_x n_z \sin^2\phi + 2n_y\cos \phi\sin \phi \\ 2n_y n_x \sin^2\phi + 2n_z\cos \phi\sin \phi & 2(n_y^2 - 1) \sin^2\phi + 1 & 2n_y n_z \sin^2\phi - 2n_x\cos \phi\sin \phi \\ 2n_z n_x \sin^2\phi - 2n_y\cos \phi\sin \phi & 2n_z n_y \sin^2\phi + 2n_x\cos \phi\sin \phi & 2(n_z^2 - 1) \sin^2\phi + 1 \\ \end{array} \right] \]

Where the definition of $ \vec{n} $ and $ \phi $ is the same as the definition in the description of the method transformate() .

Parameters
[in]xthe input vector (in this case it is a useless parameter)
Returns
a matrix

Reimplemented from meow::Transformation< Scalar >.

template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::jacobian ( Matrix< Scalar > const &  x,
size_t  i 
) const
inlinevirtual

Return the jacobian matrix of this transformate.

Here we need to discussion in three case:

  • i = 0, derivate by the x axis of the vector theta

    \[ \left[ \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \\ \end{array} \right] \left[ \begin{array}{ccc} 2(n_x^2 - 1) \sin^2\phi + 1 & 2n_x n_y \sin^2\phi - 2n_z\cos \phi\sin \phi & 2n_x n_z \sin^2\phi + 2n_y\cos \phi\sin \phi \\ 2n_y n_x \sin^2\phi + 2n_z\cos \phi\sin \phi & 2(n_y^2 - 1) \sin^2\phi + 1 & 2n_y n_z \sin^2\phi - 2n_x\cos \phi\sin \phi \\ 2n_z n_x \sin^2\phi - 2n_y\cos \phi\sin \phi & 2n_z n_y \sin^2\phi + 2n_x\cos \phi\sin \phi & 2(n_z^2 - 1) \sin^2\phi + 1 \\ \end{array} \right] \left[ \begin{array}{c} x \\ y \\ z \\ \end{array} \right] \]

  • i = 1, derivate by the y axis of the vector theta

    \[ \left[ \begin{array}{ccc} 0 & 0 & 1 \\ 0 & 0 & 0 \\ -1 & 0 & 0 \\ \end{array} \right] \left[ \begin{array}{ccc} 2(n_x^2 - 1) \sin^2\phi + 1 & 2n_x n_y \sin^2\phi - 2n_z\cos \phi\sin \phi & 2n_x n_z \sin^2\phi + 2n_y\cos \phi\sin \phi \\ 2n_y n_x \sin^2\phi + 2n_z\cos \phi\sin \phi & 2(n_y^2 - 1) \sin^2\phi + 1 & 2n_y n_z \sin^2\phi - 2n_x\cos \phi\sin \phi \\ 2n_z n_x \sin^2\phi - 2n_y\cos \phi\sin \phi & 2n_z n_y \sin^2\phi + 2n_x\cos \phi\sin \phi & 2(n_z^2 - 1) \sin^2\phi + 1 \\ \end{array} \right] \left[ \begin{array}{c} x \\ y \\ z \\ \end{array} \right] \]

  • i = 2, derivate by the z axis of the vector theta

    \[ \left[ \begin{array}{ccc} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \\ \end{array} \right] \left[ \begin{array}{ccc} 2(n_x^2 - 1) \sin^2\phi + 1 & 2n_x n_y \sin^2\phi - 2n_z\cos \phi\sin \phi & 2n_x n_z \sin^2\phi + 2n_y\cos \phi\sin \phi \\ 2n_y n_x \sin^2\phi + 2n_z\cos \phi\sin \phi & 2(n_y^2 - 1) \sin^2\phi + 1 & 2n_y n_z \sin^2\phi - 2n_x\cos \phi\sin \phi \\ 2n_z n_x \sin^2\phi - 2n_y\cos \phi\sin \phi & 2n_z n_y \sin^2\phi + 2n_x\cos \phi\sin \phi & 2(n_z^2 - 1) \sin^2\phi + 1 \\ \end{array} \right] \left[ \begin{array}{c} x \\ y \\ z \\ \end{array} \right] \]

Where $ (x,y,z) $ is the input vector, $ \vec{n}, \phi $ is the same one in the description of transformate().

Parameters
[in]xthe input vector
[in]ithe index of the parameters(theta) to dervite
Returns
a matrix

Reimplemented from meow::Transformation< Scalar >.

template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::jacobianInv ( Matrix< Scalar > const &  x) const
inlinevirtual

Return the jacobian matrix of the inverse form of this transformate.

Parameters
[in]xthe input vector
Returns
a matrix

Reimplemented from meow::Transformation< Scalar >.

template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::jacobianInv ( Matrix< Scalar > const &  x,
size_t  i 
) const
inlinevirtual

Return the jacobian matrix of the inverse form of this transformate.

Parameters
[in]xthe input vector
[in]ithe index of the parameters(theta) to dervite
Returns
a matrix

Reimplemented from meow::Transformation< Scalar >.

template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::matrixInv ( ) const
inlinevirtual

Return the inverse matrix.

In this case, the inverse matrix is equal to the transpose of the matrix

Returns
a matrix

Reimplemented from meow::LinearTransformation< Scalar >.

template<class Scalar>
Rotation3D& meow::Rotation3D< Scalar >::operator= ( Rotation3D< Scalar > const &  b)
inline

same as copyFrom(b)

template<class Scalar>
Scalar meow::Rotation3D< Scalar >::parameter ( size_t  i) const
inlinevirtual

same as theta(i)

Implements meow::Transformation< Scalar >.

template<class Scalar>
Scalar meow::Rotation3D< Scalar >::parameter ( size_t  i,
Scalar const &  s 
)
inlinevirtual

same as theta(i, s)

Implements meow::Transformation< Scalar >.

template<class Scalar>
Rotation3D& meow::Rotation3D< Scalar >::referenceFrom ( Rotation3D< Scalar > const &  b)
inline

Reference data.

Parameters
[in]banother Rotation3D class.
Returns
*this
template<class Scalar>
Scalar const& meow::Rotation3D< Scalar >::theta ( size_t  i) const
inline

Get the i -th theta.

i can only be 1, 2 or 3

Parameters
[in]iindex
Returns
i -th theta
template<class Scalar>
Scalar const& meow::Rotation3D< Scalar >::theta ( size_t  i,
Scalar const &  s 
)
inline

Set the i -th theta.

i can only be 1, 2 or 3

Parameters
[in]iindex
[in]snew theta value
Returns
i -th theta
template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::transformate ( Matrix< Scalar > const &  x) const
inlinevirtual

Do the transformate.

Assume:

  • The input vector is $ (x ,y ,z ) $
  • The output vector is $ (x',y',z') $
  • The parameters theta is $ \vec{\theta}=(\theta_x,\theta_y,\theta_z) $

Then we have:

\[ \left[ \begin{array}{c} x' \\ y' \\ z' \\ \end{array} \right] = \left[ \begin{array}{ccc} 2(n_x^2 - 1) \sin^2\phi + 1 & 2n_x n_y \sin^2\phi - 2n_z\cos \phi\sin \phi & 2n_x n_z \sin^2\phi + 2n_y\cos \phi\sin \phi \\ 2n_y n_x \sin^2\phi + 2n_z\cos \phi\sin \phi & 2(n_y^2 - 1) \sin^2\phi + 1 & 2n_y n_z \sin^2\phi - 2n_x\cos \phi\sin \phi \\ 2n_z n_x \sin^2\phi - 2n_y\cos \phi\sin \phi & 2n_z n_y \sin^2\phi + 2n_x\cos \phi\sin \phi & 2(n_z^2 - 1) \sin^2\phi + 1 \\ \end{array} \right] \left[ \begin{array}{c} x \\ y \\ z \\ \end{array} \right] \]

Where:

  • $ \phi $ is the helf of length of $ \vec{\theta} $ , which means $ \phi = \frac{\left|\vec{\theta}\right|}{2} = \frac{1}{2}\sqrt{\theta_x^2 + \theta_y^2 + \theta_z^2} $
  • $ \vec{n} $ is the normalized form of $ \vec{\theta} $ , which means $ \vec{n} = (n_x,n_y,n_z) = \vec{\theta} / 2\phi $
Parameters
[in]xthe input vector
Returns
the output matrix

Implements meow::Transformation< Scalar >.

template<class Scalar>
Matrix<Scalar> meow::Rotation3D< Scalar >::transformateInv ( Matrix< Scalar > const &  x) const
inlinevirtual

Do the inverse transformate.

Parameters
[in]xthe input vector
Returns
the output vector

Reimplemented from meow::Transformation< Scalar >.


The documentation for this class was generated from the following file: