GVectors::Rotation Class Reference

The Rotation class. More...

#include <rotation.h>

List of all members.

Public Member Functions

 Rotation ()
 Constructor.
 Rotation (double x0, double y0, double z0, Angle_Type at=ANG_RAD)
 Constructor.
 ~Rotation ()
 Destructor.
 Rotation (const Rotation &r)
 Copy constructor.
void setX (double x, Angle_Type at=ANG_RAD)
 Set the rotation in x direction.
void X (double x, Angle_Type at=ANG_RAD)
 Set the rotation in x direction.
void setY (double y, Angle_Type at=ANG_RAD)
 Set the rotation in y direction.
void Y (double y, Angle_Type at=ANG_RAD)
 Set the rotation in y direction.
void setZ (double z, Angle_Type at=ANG_RAD)
 Set the rotation in z direction.
void Z (double z, Angle_Type at=ANG_RAD)
 Set the rotation in z direction.
void set (double x, double y, double z, Angle_Type at=ANG_RAD)
 Set the rotation in x, y, and z direction.
double getX (Angle_Type at=ANG_RAD) const
 Get the rotation in x direction.
double X (Angle_Type at=ANG_RAD) const
 Get the rotation in x direction.
double getY (Angle_Type at=ANG_RAD) const
 Get the rotation in y direction.
double Y (Angle_Type at=ANG_RAD) const
 Get the rotation in y direction.
double getZ (Angle_Type at=ANG_RAD) const
 Get the rotation in z direction.
double Z (Angle_Type at=ANG_RAD) const
 Get the rotation in z direction.
void get (double &x_, double &y_, double &z_, Angle_Type at=ANG_RAD) const
 Get the rotation in x, y, and z direction.
void get_matrix (Matrix4x4 &mx, Matrix4x4 &my, Matrix4x4 &mz) const
 Get the matrices describing the rotation.
void get_inverse_matrix (Matrix4x4 &mx, Matrix4x4 &my, Matrix4x4 &mz) const
 Get the inverse matrices describing the rotation.
void incX_by (double i, Angle_Type at=ANG_RAD)
 Increment the x rotation by a certain value.
void incY_by (double i, Angle_Type at=ANG_RAD)
 Increment the y rotation by a certain value.
void incZ_by (double i, Angle_Type at=ANG_RAD)
 Increment the z rotation by a certain value.
void decX_by (double i, Angle_Type at=ANG_RAD)
 Decrement the x rotation by a certain value.
void decY_by (double i, Angle_Type at=ANG_RAD)
 Decrement the y rotation by a certain value.
void decZ_by (double i, Angle_Type at=ANG_RAD)
 Decrement the z rotation by a certain value.
void set_wrap_at_2pi (bool w=true)
 Make the angles wrap at 2*pi.
bool get_wrap_at_2PI () const
 Get the value of the wrap flag.
void set_always_positive (bool a=true)
 Sets the 'always positive' flag.
bool get_always_positive () const
 Get the value of the 'always positive' flag.
const Rotationoperator= (const Rotation &r)
 Assignment operator.
Rotation operator+ (const Rotation &r) const
 Addition operator.
Rotation operator- (const Rotation &r) const
 Subtraction operator.
const Rotationoperator+= (const Rotation &r)
 Shorthand assignment addition operator.
const Rotationoperator-= (const Rotation &r)
 Shorthand assignemnt subtraction operator.

Private Member Functions

void wrap (double &v)
 Wraps the angle provided.
void make_positive (double &v)
 Makes the angle positive.
void wrap_all ()
 Wrap all angles.
void make_all_positive ()
 Make all angles positive.

Private Attributes

double rot_x
 The rotation in x direction.
double rot_y
 The rotation in y direction.
double rot_z
 The rotation in z direction.
bool wrap_at_2pi
 Flag ensuring angles always less than 2*pi.
bool always_positive
 Flag ensuring that angles are always positive.


Detailed Description

The Rotation class has two purposes. First, it keeps track of the rotation angles in x, y, and z direction. Second, it can create the matrices to transform the rotation in 2D.


Constructor & Destructor Documentation

Rotation::Rotation (  ) 

Constructor. Initializes all angles to zero.

Rotation::Rotation ( double  x0,
double  y0,
double  z0,
Angle_Type  at = ANG_RAD 
)

Constructor. Initializes all rotation angles to the given angles.

Parameters:
x0 The rotation in x direction.
y0 The rotation in y direction.
z0 The rotation in z direction.
at The type of the angles provided. See Angle_Type for further details.

Rotation::~Rotation (  ) 

Destructor. Does nothing. Just for completeness.

Rotation::Rotation ( const Rotation r  ) 

Copy constructor.

Parameters:
r A const reference to a Rotation object.


Member Function Documentation

void Rotation::wrap ( double &  v  )  [private]

Wraps the given angle to satisfy

-2 * pi < x < 2 * pi

Parameters:
v The angle in radians.
Returns:
The wrapped angle in v.

void Rotation::make_positive ( double &  v  )  [private]

Makes the given angle positive.

Parameters:
v The angle in radians.
Returns:
The positive angle in v.

void Rotation::wrap_all (  )  [private]

Wraps all angles.

void Rotation::make_all_positive (  )  [private]

Makes all angles positive.

void Rotation::setX ( double  x,
Angle_Type  at = ANG_RAD 
)

Sets the x rotation angle.

Parameters:
x The x rotation angle.
at The type of the angle passed to the method.

void Rotation::X ( double  x,
Angle_Type  at = ANG_RAD 
)

Sets the x rotation angle.

Parameters:
x The x rotation angle.
at The type of the angle passed to the method.

void Rotation::setY ( double  y,
Angle_Type  at = ANG_RAD 
)

Sets the y rotation angle.

Parameters:
y The y rotation angle.
at The type of the angle passed to the method.

void Rotation::Y ( double  y,
Angle_Type  at = ANG_RAD 
)

Sets the y rotation angle.

Parameters:
y The y rotation angle.
at The type of the angle passed to the method.

void Rotation::setZ ( double  z,
Angle_Type  at = ANG_RAD 
)

Sets the z rotation angle.

Parameters:
z The z rotation angle.
at The type of the angle passed to the method.

void Rotation::Z ( double  z,
Angle_Type  at = ANG_RAD 
)

Sets the z rotation angle.

Parameters:
z The z rotation angle.
at The type of the angle passed to the method.

void Rotation::set ( double  x,
double  y,
double  z,
Angle_Type  at = ANG_RAD 
)

Sets all rotation angles.

Parameters:
x The rotation in x direction.
y The rotation in y direction.
z The rotation in z direction.
at The type of the angle passed to the method.

double Rotation::getX ( Angle_Type  at = ANG_RAD  )  const

Gets the rotation in x direction.

Parameters:
at The measurement of the angle returned.
Returns:
The rotation in x direction.

double Rotation::X ( Angle_Type  at = ANG_RAD  )  const

Gets the rotation in x direction.

Parameters:
at The measurement of the angle returned.
Returns:
The rotation in x direction.

double Rotation::getY ( Angle_Type  at = ANG_RAD  )  const

Gets the rotation in y direction.

Parameters:
at The measurement of the angle returned.
Returns:
The rotation in y direction.

double Rotation::Y ( Angle_Type  at = ANG_RAD  )  const

Gets the rotation in y direction.

Parameters:
at The measurement of the angle returned.
Returns:
The rotation in y direction.

double Rotation::getZ ( Angle_Type  at = ANG_RAD  )  const

Gets the rotation in z direction.

Parameters:
at The measurement of the angle returned.
Returns:
The rotation in z direction.

double Rotation::Z ( Angle_Type  at = ANG_RAD  )  const

Gets the rotation in z direction.

Parameters:
at The measurement of the angle returned.
Returns:
The rotation in z direction.

void Rotation::get ( double &  x,
double &  y,
double &  z,
Angle_Type  at = ANG_RAD 
) const

Gets the rotation angles.

Parameters:
x The rotation in x direction.
y The rotation in y direction.
z The rotation in z direction.
at The measurement of the angles returned.

void Rotation::get_matrix ( Matrix4x4 mx,
Matrix4x4 my,
Matrix4x4 mz 
) const

Gets all rotation matrices. It expects all matrices to be initialized to zero.

Parameters:
mx The x rotation matrix.
my The y rotation matrix.
mz The z rotation matrix.

void Rotation::get_inverse_matrix ( Matrix4x4 mx,
Matrix4x4 my,
Matrix4x4 mz 
) const

Gets all inverted rotation matrices. It expects all matrices to be initialized to zero.

Parameters:
mx The inverted x rotation matrix.
my The inverted y rotation matrix.
mz The inverted z rotation matrix.

void Rotation::incX_by ( double  i,
Angle_Type  at = ANG_RAD 
)

Increments the x rotation angle by the given value.

Parameters:
i Incrementation step.
at Measurement of the incrementation.

void Rotation::incY_by ( double  i,
Angle_Type  at = ANG_RAD 
)

Increments the y rotation angle by the given value.

Parameters:
i Incrementation step.
at Measurement of the incrementation.

void Rotation::incZ_by ( double  i,
Angle_Type  at = ANG_RAD 
)

Increments the z rotation angle by the given value.

Parameters:
i Incrementation step.
at Measurement of the incrementation.

void Rotation::decX_by ( double  i,
Angle_Type  at = ANG_RAD 
)

Decrements the x rotation angle by the given value.

Parameters:
i Decrementation step.
at Measurement of the decrementation.

void Rotation::decY_by ( double  i,
Angle_Type  at = ANG_RAD 
)

Decrements the y rotation angle by the given value.

Parameters:
i Decrementation step.
at Measurement of the decrementation.

void Rotation::decZ_by ( double  i,
Angle_Type  at = ANG_RAD 
)

Decrements the z rotation angle by the given value.

Parameters:
i Decrementation step.
at Measurement of the decrementation.

void Rotation::set_wrap_at_2pi ( bool  w = true  ) 

Sets the wrap flag.

When set to true, the rotation angles are guaranteed to be

-2 * pi < x < 2 * pi

Parameters:
w True to set the flag, false to clear.

bool GVectors::Rotation::get_wrap_at_2PI (  )  const [inline]

Gets the value of the wrap flag. See also Rotation::set_wrap_at_2pi().

Returns:
The value of the flag.
Return values:
true The flag is set.
false. The flag is not set.

void Rotation::set_always_positive ( bool  a = true  ) 

Sets the 'always positive' flag.

When set to true, the rotation angles are guaranteed to be

0 =< x < 2 * pi .

Parameters:
a True to set the flag, false to clear.

bool GVectors::Rotation::get_always_positive (  )  const [inline]

Gets the value of the 'always positive' flag. See also Rotation::set_always_positive().

Returns:
The value of the flag.
Return values:
true The flag is set.
false. The flag is not set.

const Rotation & Rotation::operator= ( const Rotation r  ) 

Assignment operator.

Parameters:
r A const reference to a Rotation object.
Returns:
A const reference to this.

Rotation Rotation::operator+ ( const Rotation r  )  const

Adds two Rotation objects.

Parameters:
r A const reference to the Rotation to be added.
Returns:
A Rotation object holding the sum.

Rotation Rotation::operator- ( const Rotation r  )  const

Subtracts two Rotation objects.

Parameters:
r A const reference to the Rotation to be subtracted.
Returns:
A Rotation object holding the difference.

const Rotation & Rotation::operator+= ( const Rotation r  ) 

Shorthand addition operator.

Parameters:
r A const reference to a Rotation.
Returns:
A const reference to this holding the sum.

const Rotation & Rotation::operator-= ( const Rotation r  ) 

Shorthand subtraction operator.

Parameters:
r A const reference to a Rotation.
Returns:
A const reference to this holding the difference.


Member Data Documentation

double GVectors::Rotation::rot_x [private]

This is the angle of rotation in x direction expressed in radians.

double GVectors::Rotation::rot_y [private]

This is the angle of rotation in y direction expressed in radians.

double GVectors::Rotation::rot_z [private]

This is the angle of rotation in z direction expressed in radians.

bool GVectors::Rotation::wrap_at_2pi [private]

When set to true, the angles stored in rot_* are guaranteed to be

-2 * pi < x < 2 * pi

When set to false, angles stored in rot_* can assume any value.

bool GVectors::Rotation::always_positive [private]

When set to true, the angles stored in rot_* are guaranteed to be

0 =< x < 2 * pi .

When set to false, angles can be stored as negative or positive values.


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 19:37:30 2007 for libgvectors by  doxygen 1.4.7