Rotation Class Reference

#include <Rotation.hpp>

Inheritance diagram for Rotation:

Inheritance graph
[legend]
Collaboration diagram for Rotation:

Collaboration graph
[legend]

List of all members.

Public Member Functions

TinyVector< 3, real_t > operator() (const TinyVector< 3, real_t > &x) const
TinyVector< 3, real_t > inverse (const TinyVector< 3, real_t > &x) const
std::string povWrite () const
 prints rotation information to a string.
ReferenceCounting< TransformgetCopy () const
 Rotation (const TinyVector< 3, real_t > &r)
 Rotation (const Rotation &r)
 ~Rotation ()
const TransTypetype () const
virtual TinyVector< 3, real_t > operator() (const TinyVector< 3 > &x) const =0
virtual TinyVector< 3, real_t > inverse (const TinyVector< 3 > &x) const =0

Protected Attributes

const TransType __type

Private Attributes

const TinyVector< 3, real_t > __angles
TinyMatrix< 3, 3 > __matrix


Detailed Description

Definition at line 39 of file Rotation.hpp.


Constructor & Destructor Documentation

Rotation::Rotation ( const TinyVector< 3, real_t > &  r  ) 

Constructor

Parameters:
r given POVRay angles

Definition at line 46 of file Rotation.cpp.

References __matrix.

Referenced by getCopy().

00047   : Transform(rotation),
00048     __angles(r)
00049 {
00050   const real_t deg2rad=4*std::atan(1.)/180.;
00051 
00052   const real_t cosx = std::cos(deg2rad*r[0]);
00053   const real_t cosy = std::cos(deg2rad*r[1]);
00054   const real_t cosz = std::cos(deg2rad*r[2]);
00055   const real_t sinx = std::sin(deg2rad*r[0]);
00056   const real_t siny = std::sin(deg2rad*r[1]);
00057   const real_t sinz = std::sin(deg2rad*r[2]);
00058 
00059   __matrix(0,0) =  cosy*cosz;
00060   __matrix(0,1) = -sinz*cosx + sinx*siny*cosz;
00061   __matrix(0,2) =  sinx*sinz + cosx*siny*cosz;
00062   __matrix(1,0) =  cosy*sinz;
00063   __matrix(1,1) =  cosx*cosz + sinx*siny*sinz;
00064   __matrix(1,2) = -sinx*cosy + cosx*siny*sinz;
00065   __matrix(2,0) = -siny;
00066   __matrix(2,1) =  sinx*cosy;
00067   __matrix(2,2) =  cosx*cosy;
00068 }

Rotation::Rotation ( const Rotation r  ) 

Copy Constructor

Parameters:
r given rotation

Definition at line 71 of file Rotation.cpp.

00072   : Transform(r),
00073     __angles(r.__angles),
00074     __matrix(r.__matrix)
00075 {
00076   ;
00077 }

Rotation::~Rotation (  )  [inline]

Destructor

Definition at line 105 of file Rotation.hpp.

00106   {
00107     ;
00108   }


Member Function Documentation

TinyVector< 3, real_t > Rotation::operator() ( const TinyVector< 3, real_t > &  x  )  const

Applies the Rotation to a vector

Parameters:
x given vector
Returns:
$ R(x) $

Definition at line 26 of file Rotation.cpp.

References __matrix.

00027 {
00028   return __matrix*v;
00029 }

TinyVector< 3, real_t > Rotation::inverse ( const TinyVector< 3, real_t > &  x  )  const

Applies the inverse Rotation to a vector

Parameters:
x given vector
Returns:
$ R^{-1}(x) $

Definition at line 32 of file Rotation.cpp.

References __matrix.

00033 {
00034   // As 'matrix' is composed of rotations, and
00035   // as rotations are othogonal matrices
00036   // the inverse of 'matrix' is its transposed
00037   TinyVector<3,real_t> Temporary = 0;
00038   for (size_t i=0; i<3; i++)
00039     for (size_t j=0; j<3; j++) {
00040       Temporary[i]+=__matrix(j,i)*v[j];
00041     }
00042   return Temporary;
00043 }

std::string Rotation::povWrite (  )  const [virtual]

prints rotation information to a string.

Prints Rotation informations to a string.

Returns:
Rotations information string

Implements Transform.

Definition at line 81 of file Rotation.cpp.

References __angles.

00082 {
00083   std::stringstream povs;
00084   povs << "rotation <"
00085        << __angles[0]
00086        << ", "
00087        << __angles[1]
00088        << ", "
00089        << __angles[2]
00090        << ">";
00091   povs << std::ends;
00092   return povs.str();
00093 }

ReferenceCounting< Transform > Rotation::getCopy (  )  const [virtual]

Gets a copy of the Rotation

Returns:
deep copy of the rotation

Implements Transform.

Definition at line 97 of file Rotation.cpp.

References Rotation().

00098 {
00099   return new Rotation(*this);
00100 }

Here is the call graph for this function:

const TransType& Transform::type (  )  const [inline, inherited]

Read-only access to the type of the transformation.

Returns:
__type

Definition at line 60 of file Transform.hpp.

References Transform::__type.

00061   {
00062     return __type;
00063   }

virtual TinyVector<3,real_t> Transform::operator() ( const TinyVector< 3 > &  x  )  const [pure virtual, inherited]

Applies the transformation to a point

Parameters:
x given point
Returns:
$ T(x) $

virtual TinyVector<3,real_t> Transform::inverse ( const TinyVector< 3 > &  x  )  const [pure virtual, inherited]

Applies the inverse transformation to a point

Parameters:
x given point
Returns:
$ T^{-1}(x) $


Member Data Documentation

const TinyVector<3,real_t> Rotation::__angles [private]

Rotation angles as given in POVRay

Definition at line 44 of file Rotation.hpp.

Referenced by povWrite().

The inverse of the rotation is stored in the matrix. This way one can know if a vertex is the image of a vertex contained in a base shape; so, if a vertex is in the image of shape!

Definition at line 47 of file Rotation.hpp.

Referenced by inverse(), operator()(), and Rotation().

const TransType Transform::__type [protected, inherited]

Transformation type

Definition at line 52 of file Transform.hpp.

Referenced by Transform::type().


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

Generated on Wed Nov 19 00:12:44 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6