Rotation3

Defines a rotation of 3-dimensional space.

[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

AUTHORS
CHANGES LOG
GOALS
USAGE

Class Summary

class Rotation3
{
public:
// define real type
typedef Vector3::real real;
// Constructors
Rotation3();
Rotation3(const real a, const real b, const real c, const real d);
explicit Rotation3(const Matrix3& m);
Rotation3(const real& xr, const real& yr, const real& zr);
explicit Rotation3(const real m[3][3]);
explicit Rotation3(const double m[3][3]);
Rotation3(const Vector3& v1, const Vector3& v2, const Vector3& v3);
// Inspection methods and properties.
const real operator[](const unsigned short index) const;
Vector3 row(const unsigned short r) const;
Vector3 column(const unsigned short col) const;
real element(const unsigned short r, const unsigned short col) const;
real rotX() const;
real rotY() const;
real rotZ() const;
Vector3 rotationAngles() const;
real trace() const;
real dist2(const Rotation3& r) const;
real dist(const Rotation3& r) const;
// Operators
operator Matrix3() const;
Rotation3& operator*=(const Rotation3 &);
friend Rotation3 operator*(const Rotation3&, const Rotation3&);
friend Rotation3 operator!(const Rotation3&);
friend Vector3 operator*(const Rotation3&, const Vector3&);
friend ostream& operator<<(ostream& s, const Rotation3& t);
protected:
Rotation3(const real a, const real b, const real c, const real d, int);
}; // Rotation3

Back to the top of Rotation3


AUTHORS

Meir Fuchs. (meirfux@math.tau.ac.il)

Copyright: SAMBA group, Tel-Aviv Univ. Israel, 1997.

Back to the top of Rotation3


CHANGES LOG

Back to the top of Rotation3


GOALS

Rotation3 hold a 3-dimensional rotation compactly. Using quaternions a rotation may be held compactly without sacrificing much on the performance side. Rotation3 should support most of the methods implemented in Matrix3.

Back to the top of Rotation3


USAGE

Rotation3 hosts a set of constructors, operators and inspection methods. Below are just several examples of how one may use the class.

    Rotation3 ra(1.0, 1.1, -1.3);  // rotation angles.
    Rotation3 rb(0.9, -2.3, 0.1);  // rotation angles.

    Matrix3 a= ra;
    Matrix3 b= rb;

    Rotation3 rab = ra*rb;
    Matrix3 ab = a*b;  // rab should be = to ab;

    Vector3 v(1.0, 2.0, 3.0);
    cout !rab*v;

Back to the top of Rotation3


typedef Vector3::real real;

real is defined using the real defined in Vector3 class. By default this is of type float. For example , changing Vector3::real's defintion to double will turn the gamb library's vector operations to double precision.

  typedef Vector3::real real;

Back to the top of Rotation3


Rotation3();

Default constructor: 0 matrix.

  Rotation3();

Back to the top of Rotation3


Rotation3(const real a, const real b, const real c, const real d);

Instantiate a rotation using 4 quaternion parameters.

  Rotation3(const real a, const real b, const real c, const real d);

Back to the top of Rotation3


explicit Rotation3(const Matrix3& m);

Instantiate a Rotation3 using a rotation matrix. If the matrix is not a rotation matrix the parameters will be normalized.

  explicit Rotation3(const Matrix3& m);

Back to the top of Rotation3


Rotation3(const real& xr, const real& yr, const real& zr);

Creates a Rotation3 object. given rotational angles around the x axis (xr), around the y axis (yr) and around the z axis (zr) a linear transformation that rotates space in the order x-y-z is created. Rotation in this order is the default representation for the gamb++ library rotational transformations.

  Rotation3(const real& xr, const real& yr, const real& zr);

Back to the top of Rotation3


explicit Rotation3(const real m[3][3]);

Use a 3x3 real 2D array matrix to initialize a Rotation3. If matrix is not a rotation it is "normalized".

  explicit Rotation3(const real m[3][3]);

Back to the top of Rotation3


explicit Rotation3(const double m[3][3]);

Use a 3x3 double prec. 2D array matrix to initialize a Rotation3. If matrix is not a rotation it is "normalized".

  explicit Rotation3(const double m[3][3]);

Back to the top of Rotation3


Rotation3(const Vector3& v1, const Vector3& v2, const Vector3& v3);

Constructs a Rotation3 using the 3 given matrix row vectors. If matrix is not a rotation it is "normalized".

  Rotation3(const Vector3& v1, const Vector3& v2, const Vector3& v3);

Back to the top of Rotation3


const real operator[](const unsigned short index) const;

Returns the ith element of quaternion representing the rotation. index may take values from 0 to 3. Otherwise results are undefined.

  const real operator[](const unsigned short index) const;

Back to the top of Rotation3


Vector3 row(const unsigned short r) const;

Returns a vector matching the r'th row of the rotation matrix representing the rotation object . r must be in the range 1..3 or run time errors may occur.

  Vector3 row(const unsigned short r) const;

Back to the top of Rotation3


Vector3 column(const unsigned short col) const;

Returns a vector matching the col'th column of the rotation matrix representing the rotation object . r must be in the range 1..3 or run time errors may occur.

  Vector3 column(const unsigned short col) const;

Back to the top of Rotation3


real element(const unsigned short r, const unsigned short col) const;

Returns the numerical value at position row, col in the 3X3 matrix representing the rotation. row, col should be within the range of 1..3 or run time errors may occur. / Use the matrix(ij) familiy of methods for faster access.

  real element(const unsigned short r, const unsigned short col) const;

Back to the top of Rotation3


real rotX() const;

Returns the rotation around the x-axis for a rotational matrix assuming rotations are performed in the order of x-y-z.

  real rotX() const;

Back to the top of Rotation3


real rotY() const;

Returns the rotation around the y-axis for a rotational matrix assuming rotations are performed in the order of x-y-z.

  real rotY() const;

Back to the top of Rotation3


real rotZ() const;

Returns the rotation around the z-axis for a rotational matrix assuming rotations are performed in the order of x-y-z.

  real rotZ() const;

Back to the top of Rotation3


Vector3 rotationAngles() const;

Returns 3 rotation angles assuming rotations are performed in the order of x-y-z.

  Vector3 rotationAngles() const;

Back to the top of Rotation3


real trace() const;

Returns the trace of the rotation matrix representing the rotation.

  real trace() const;

Back to the top of Rotation3


real dist2(const Rotation3& r) const;

Returns squared distance between 2 rotations. Currently this is implemented by taking the euclidean distance between the 4 parameters of the quternion.

  real dist2(const Rotation3& r) const;

Back to the top of Rotation3


real dist(const Rotation3& r) const;

Returns distance between 2 rotations. Currently this is implemented by taking the euclidean distance between the 4 parameters of the quternion.

  real dist(const Rotation3& r) const;

Back to the top of Rotation3


operator Matrix3() const;

Convert a Rotation3 object to Matrix3 type.

  operator Matrix3() const;

Back to the top of Rotation3


Rotation3& operator*=(const Rotation3 &);

In place multiplication with a given rotation object.

  Rotation3& operator*=(const Rotation3 &);

Back to the top of Rotation3


friend Rotation3 operator*(const Rotation3&, const Rotation3&);

Multiplication of two rotations.

  friend Rotation3 operator*(const Rotation3&, const Rotation3&);

Back to the top of Rotation3


friend Rotation3 operator!(const Rotation3&);

Inverse rotation.

  friend Rotation3 operator!(const Rotation3&);

Back to the top of Rotation3


friend Vector3 operator*(const Rotation3&, const Vector3&);

Rotation by vector multiplication.

  friend Vector3 operator*(const Rotation3&, const Vector3&);

Back to the top of Rotation3


friend ostream& operator<<(ostream& s, const Rotation3& t);

Output rotation in quaternion format.

  friend ostream& operator<<(ostream& s, const Rotation3& t);

Back to the top of Rotation3


Rotation3(const real a, const real b, const real c, const real d, int);

Instantiate a rotation using 4 quaternion parameters. This version differs from the public version. It dows not normalize the quaternion and does not make sure the 4 parameters actually represent a rotation.

  Rotation3(const real a, const real b, const real c, const real d, int);

Back to the top of Rotation3


All Members

public:
// define real type
typedef Vector3::real real;
// Constructors
explicit Rotation3(const Matrix3& m);
explicit Rotation3(const real m[3][3]);
explicit Rotation3(const double m[3][3]);
// Inspection methods and properties.
const real operator[](const unsigned short index) const;
Vector3 row(const unsigned short r) const;
Vector3 column(const unsigned short col) const;
real element(const unsigned short r, const unsigned short col) const;
real rotX() const;
real rotY() const;
real rotZ() const;
Vector3 rotationAngles() const;
real trace() const;
real dist2(const Rotation3& r) const;
real dist(const Rotation3& r) const;
// Operators
operator Matrix3() const;
Rotation3& operator*=(const Rotation3 &);
friend Rotation3 operator*(const Rotation3&, const Rotation3&);
friend Rotation3 operator!(const Rotation3&);
friend Vector3 operator*(const Rotation3&, const Vector3&);
friend ostream& operator<<(ostream& s, const Rotation3& t);
protected:

Back to the top of Rotation3


Ancestors

Class does not inherit from any other class.

Back to the top of Rotation3


Descendants

Class is not inherited by any others.

Back to the top of Rotation3


Generated from source by the Cocoon utilities on Sun Nov 15 13:35:26 2009 .

Report problems to jkotula@unimax.com