Archon::Math::Matrix3x3 Struct Reference

A 3x3 matrix. More...

#include <archon/math/matrix.H>

Collaboration diagram for Archon::Math::Matrix3x3:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Matrix3x3 ()
 Matrix3x3 (const Vector3 &x, const Vector3 &y, const Vector3 &z)
 Matrix3x3 (Vector3 y, Vector3 z)
 Produce a righthanded orthonormal map or coordinate system basis.
 Matrix3x3 (const Rotation3 &r)
 Matrix3x3 (const Quaternion &q)
Vector3 getRow1 () const
Vector3 getRow2 () const
Vector3 getRow3 () const
double dotRow1 (const Vector3 &v) const
double dotRow2 (const Vector3 &v) const
double dotRow3 (const Vector3 &v) const
Vector3 diag () const
double det () const
Matrix3x3 operator+ (const Matrix3x3 &m) const
Matrix3x3 operator- (const Matrix3x3 &m) const
Matrix3x3 operator * (const Matrix3x3 &m) const
Matrix3x3 operator/ (const Matrix3x3 &m) const
void map (Vector3 &v) const
Vector3 operator() (const Vector3 &v) const
Vector3 operator * (const Vector3 &v) const
Matrix3x3 operator * (double f) const
Matrix3x3 operator/ (double f) const
Matrix3x3 operator- () const
Matrix3x3operator+= (const Matrix3x3 &m)
Matrix3x3operator-= (const Matrix3x3 &m)
Matrix3x3operator *= (const Matrix3x3 &m)
Matrix3x3operator/= (const Matrix3x3 &m)
Matrix3x3operator *= (double f)
Matrix3x3operator/= (double f)
bool operator== (const Matrix3x3 &m) const
bool operator!= (const Matrix3x3 &m) const
void set (const Vector3 &x, const Vector3 &y, const Vector3 &z)
void setRow1 (const Vector3 &v)
void setRow2 (const Vector3 &v)
void setRow3 (const Vector3 &v)
void setRow1 (double x, double y, double z)
void setRow2 (double x, double y, double z)
void setRow3 (double x, double y, double z)
void setRotation (const Rotation3 &)
 Create a rotation matrix M such that V x M is the rotation of V.
void setRotation (const Quaternion &)
 Create a rotation matrix M such that V x M is the rotation of V.
void setInverseOf (const Matrix3x3 &)
 Make this matrix the inverse of the argument.
void negate ()
void transpose ()
void scale (const Vector3 &s)
 Multiplication by:.
void invScale (const Vector3 &s)
 Multiplication by:.
void rotate (const Rotation3 &r)
 Think of this matrix as a basis and let r.normalizedAxis be specified in the coordinates of it.
void pitch (double angle)
 Rotate basis around its x-axis.
void yaw (double angle)
 Rotate basis around its y-axis.
void roll (double angle)
 Rotate basis around its z-axis.
void rotateRightHandedOrthoNormal (const Rotation3 &)
 Rotate right-handed ortho-normal basis around any axis.
void pitchRightHandedOrthoNormal (double angle)
 Rotate right-handed ortho-normal basis around its x-axis.
void yawRightHandedOrthoNormal (double angle)
 Rotate right-handed ortho-normal basis around its y-axis.
void rollRightHandedOrthoNormal (double angle)
 Rotate right-handed ortho-normal basis around its z-axis.

Static Public Member Functions

static const Matrix3x3zero ()
static const Matrix3x3identity ()

Public Attributes

Vector3 x
Vector3 y
Vector3 z

Detailed Description

A 3x3 matrix.

Layout:

 x[0]  y[0]  z[0]
 x[1]  y[1]  z[1]
 x[2]  y[2]  z[2]

 

Definition at line 42 of file matrix.H.


Constructor & Destructor Documentation

Archon::Math::Matrix3x3::Matrix3x3 Vector3  y,
Vector3  z
[inline]
 

Produce a righthanded orthonormal map or coordinate system basis.

The x-axis is given as y cross z, the y axis is given as x-axis cross z, and the z.axis is given as z.

Note that "ortho" refers to the fact that the axes are perpendicular to each other when seen from the reference coordinate system. "normal" means that the axis vectors have unit lenght when seen from the reference coordinate system. "righthanded" means that the three axes are arranged according to the right-hand rule ie. z-axis = x-axis cross y-axis when seen from the reference coordinate system.

Parameters:
y A control vector for determining the y-axis. The y-axis is constrained to lie in the plane spanned by y and z. y must not be parallel to z. y does not need to be a normalized vector.
z the direction of the positive z-axis. z must not be parallel to y. z does not need to be a normalized vector.
This constructor may be use to simulate the principal effect of gluLookAt from the OpenGL utility package. That is gluLookAt(eye, center, up) may be calculated as:

   setInverseOf(CoordSystem3x3(eye, Matrix3x3(up, eye-center)))

 

Definition at line 83 of file matrix.H.


Member Function Documentation

void Archon::Math::Matrix3x3::invScale const Vector3 s  )  [inline]
 

Multiplication by:.

1/s[0] 0 0 0 1/s[1] 0 0 0 1/s[2]

Definition at line 195 of file matrix.H.

References x, y, and z.

Referenced by Archon::X3D::Viewer::renderFrame().

void Archon::Math::Matrix3x3::pitchRightHandedOrthoNormal double  angle  ) 
 

Rotate right-handed ortho-normal basis around its x-axis.

Using rotate, pitch, yaw or roll repeatedly for small steps may easily lead to lack of ortho-normality. Therefore this method applies stabilization that keeps the basis right-handed and ortho-normal.

Definition at line 203 of file matrix.C.

References m, map(), Archon::Math::BasicVector< T, N >::normalize(), x, y, and z.

void Archon::Math::Matrix3x3::rollRightHandedOrthoNormal double  angle  ) 
 

Rotate right-handed ortho-normal basis around its z-axis.

Using rotate, pitch, yaw or roll repeatedly for small steps may easily lead to lack of ortho-normality. Therefore this method applies stabilization that keeps the basis right-handed and ortho-normal.

Definition at line 241 of file matrix.C.

References m, map(), Archon::Math::BasicVector< T, N >::normalize(), x, y, and z.

void Archon::Math::Matrix3x3::rotate const Rotation3 r  ) 
 

Think of this matrix as a basis and let r.normalizedAxis be specified in the coordinates of it.

Then 'rotate' rotates this matrix around that axis. Note, if you want to apply the same rotation to several matrices, then it is more efficient to create a rotation matrix first, and then map through it each of the matrixes that are to be rotated.

Definition at line 153 of file matrix.C.

References Matrix3x3(), and operator *=().

Referenced by Archon::Raytracer::SceneLoader::doTransform(), pitch(), Archon::X3D::Viewer::renderFrame(), roll(), Archon::Raytracer::ViewState::trackballRoll(), Archon::Console3d::ViewState::trackballRoll(), and yaw().

void Archon::Math::Matrix3x3::rotateRightHandedOrthoNormal const Rotation3  ) 
 

Rotate right-handed ortho-normal basis around any axis.

Using rotate, pitch, yaw or roll repeatedly for small steps may easily lead to lack of ortho-normality. Therefore this method applies stabilization that keeps the basis right-handed and ortho-normal.

Definition at line 190 of file matrix.C.

References m, map(), Archon::Math::BasicVector< T, N >::normalize(), x, y, and z.

Referenced by Archon::Math::CoordSystem3x3::minimalTurn().

void Archon::Math::Matrix3x3::scale const Vector3 s  )  [inline]
 

Multiplication by:.

s[0] 0 0 0 s[1] 0 0 0 s[2]

Definition at line 181 of file matrix.H.

References x, y, and z.

Referenced by Archon::Raytracer::Cylinder::Cylinder(), Archon::Raytracer::SceneLoader::doTransform(), and Archon::X3D::Viewer::renderFrame().

void Archon::Math::Matrix3x3::setRotation const Rotation3  ) 
 

Create a rotation matrix M such that V x M is the rotation of V.

The angle must be given in radians. The axis must be a unit vector.

Definition at line 81 of file matrix.C.

References Archon::Math::Rotation3::angle, Archon::Math::Rotation3::axis, Archon::Math::BasicVector< T, N >::set(), x, y, and z.

Referenced by Matrix3x3().

void Archon::Math::Matrix3x3::yawRightHandedOrthoNormal double  angle  ) 
 

Rotate right-handed ortho-normal basis around its y-axis.

Using rotate, pitch, yaw or roll repeatedly for small steps may easily lead to lack of ortho-normality. Therefore this method applies stabilization that keeps the basis right-handed and ortho-normal.

Definition at line 222 of file matrix.C.

References m, map(), Archon::Math::BasicVector< T, N >::normalize(), x, y, and z.


The documentation for this struct was generated from the following files:
Generated on Sun Jul 30 22:56:56 2006 for Archon by  doxygen 1.4.4