Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Matrix3< T > Class Template Reference

#include <vecmath.h>

Inheritance diagram for Matrix3< T >:

Inheritance graph
List of all members.

Public Member Functions

Vector3< T > column (int) const
determinant () const
Matrix3< T > inverse () const
template<class U>
 Matrix3 (const Matrix3< U > &)
 Matrix3 (const Vector3< T > &, const Vector3< T > &, const Vector3< T > &)
 Matrix3 ()
Matrix3operator *= (T)
const Vector3< T > & operator[] (int) const
Vector3< T > row (int) const
Matrix3< T > transpose () const

Static Public Member Functions

static Matrix3< T > identity ()
static Matrix3< T > scaling (T)
static Matrix3< T > scaling (const Vector3< T > &)
static Matrix3< T > xrotation (T)
static Matrix3< T > yrotation (T)
static Matrix3< T > zrotation (T)

Public Attributes

Vector3< T > r [3]

template<class T>
class Matrix3< T >


Constructor & Destructor Documentation

template<class T>
Matrix3< T >::Matrix3  ) 
 

Definition at line 573 of file vecmath.h.

References Matrix3< T >::r.

00574 {
00575     r[0] = Vector3<T>(0, 0, 0);
00576     r[1] = Vector3<T>(0, 0, 0);
00577     r[2] = Vector3<T>(0, 0, 0);
00578 }

template<class T>
Matrix3< T >::Matrix3 const Vector3< T > &  ,
const Vector3< T > &  ,
const Vector3< T > & 
 

Definition at line 581 of file vecmath.h.

References Matrix3< T >::r.

00584 {
00585     r[0] = r0;
00586     r[1] = r1;
00587     r[2] = r2;
00588 }

template<class T>
template<class U>
Matrix3< T >::Matrix3 const Matrix3< U > &   ) 
 


Member Function Documentation

template<class T>
Vector3< T > Matrix3< T >::column int   )  const [inline]
 

Definition at line 619 of file vecmath.h.

References Matrix3< T >::r.

00620 {
00621     return Vector3<T>(r[0][n], r[1][n], r[2][n]);
00622 }

template<class T>
T Matrix3< T >::determinant  )  const
 

Definition at line 710 of file vecmath.h.

References Matrix3< T >::r.

Referenced by Matrix3< T >::inverse().

00711 {
00712     return (r[0].x * r[1].y * r[2].z +
00713             r[0].y * r[1].z * r[2].x +
00714             r[0].z * r[1].x * r[2].y -
00715             r[0].z * r[1].y * r[2].x -
00716             r[0].x * r[1].z * r[2].y -
00717             r[0].y * r[1].x * r[2].z);
00718 }

template<class T>
Matrix3< T > Matrix3< T >::identity  )  [static]
 

Definition at line 689 of file vecmath.h.

00690 {
00691     return Matrix3<T>(Vector3<T>(1, 0, 0),
00692                       Vector3<T>(0, 1, 0),
00693                       Vector3<T>(0, 0, 1));
00694 }

template<class T>
Matrix3< T > Matrix3< T >::inverse  )  const
 

Definition at line 721 of file vecmath.h.

References det2x2(), Matrix3< T >::determinant(), and Matrix3< T >::r.

00722 {
00723     Matrix3<T> adjoint;
00724 
00725     // Just use Cramer's rule for now . . .
00726     adjoint.r[0].x =  det2x2(r[1].y, r[1].z, r[2].y, r[2].z);
00727     adjoint.r[0].y = -det2x2(r[1].x, r[1].z, r[2].x, r[2].z);
00728     adjoint.r[0].z =  det2x2(r[1].x, r[1].y, r[2].x, r[2].y);
00729     adjoint.r[1].x = -det2x2(r[0].y, r[0].z, r[2].y, r[2].z);
00730     adjoint.r[1].y =  det2x2(r[0].x, r[0].z, r[2].x, r[2].z);
00731     adjoint.r[1].z = -det2x2(r[0].x, r[0].y, r[2].x, r[2].y);
00732     adjoint.r[2].x =  det2x2(r[0].y, r[0].z, r[1].y, r[1].z);
00733     adjoint.r[2].y = -det2x2(r[0].x, r[0].z, r[1].x, r[1].z);
00734     adjoint.r[2].z =  det2x2(r[0].x, r[0].y, r[1].x, r[1].y);
00735     adjoint *= 1 / determinant();
00736 
00737     return adjoint;
00738 }

template<class T>
Matrix3< T > & Matrix3< T >::operator *=  )  [inline]
 

Definition at line 624 of file vecmath.h.

References Matrix3< T >::r.

00625 {
00626     r[0] *= s;
00627     r[1] *= s;
00628     r[2] *= s;
00629     return *this;
00630 }

template<class T>
const Vector3< T > & Matrix3< T >::operator[] int   )  const [inline]
 

Definition at line 608 of file vecmath.h.

References Matrix3< T >::r.

00609 {
00610     //    return const_cast<Vector3<T>&>(r[n]);
00611     return r[n];
00612 }

template<class T>
Vector3< T > Matrix3< T >::row int   )  const [inline]
 

Definition at line 614 of file vecmath.h.

References Matrix3< T >::r.

00615 {
00616     return r[n];
00617 }

template<class T>
Matrix3< T > Matrix3< T >::scaling  )  [static]
 

Definition at line 782 of file vecmath.h.

References Matrix3< T >::scaling().

00783 {
00784     return scaling(Vector3<T>(scale, scale, scale));
00785 }

template<class T>
Matrix3< T > Matrix3< T >::scaling const Vector3< T > &   )  [static]
 

Definition at line 774 of file vecmath.h.

Referenced by Matrix3< T >::scaling().

00775 {
00776     return Matrix3<T>(Vector3<T>(scale.x, 0, 0),
00777                       Vector3<T>(0, scale.y, 0),
00778                       Vector3<T>(0, 0, scale.z));
00779 }

template<class T>
Matrix3< T > Matrix3< T >::transpose  )  const
 

Definition at line 697 of file vecmath.h.

References Matrix3< T >::r.

Referenced by FrameOfReference::fromUniversal().

00698 {
00699     return Matrix3<T>(Vector3<T>(r[0].x, r[1].x, r[2].x),
00700                       Vector3<T>(r[0].y, r[1].y, r[2].y),
00701                       Vector3<T>(r[0].z, r[1].z, r[2].z));
00702 }

template<class T>
Matrix3< T > Matrix3< T >::xrotation  )  [static]
 

Definition at line 741 of file vecmath.h.

References cos(), and sin().

Referenced by JPLEphOrbit::computePosition(), TritonOrbit::computePosition(), UranianSatelliteOrbit::computePosition(), DeimosOrbit::computePosition(), PhobosOrbit::computePosition(), and EllipticalOrbit::positionAtE().

00742 {
00743     T c = (T) cos(angle);
00744     T s = (T) sin(angle);
00745 
00746     return Matrix3<T>(Vector3<T>(1, 0, 0),
00747                       Vector3<T>(0, c, -s),
00748                       Vector3<T>(0, s, c));
00749 }

template<class T>
Matrix3< T > Matrix3< T >::yrotation  )  [static]
 

Definition at line 752 of file vecmath.h.

References cos(), and sin().

Referenced by TritonOrbit::computePosition(), UranianSatelliteOrbit::computePosition(), DeimosOrbit::computePosition(), PhobosOrbit::computePosition(), and EllipticalOrbit::positionAtE().

00753 {
00754     T c = (T) cos(angle);
00755     T s = (T) sin(angle);
00756 
00757     return Matrix3<T>(Vector3<T>(c, 0, s),
00758                       Vector3<T>(0, 1, 0),
00759                       Vector3<T>(-s, 0, c));
00760 }

template<class T>
Matrix3< T > Matrix3< T >::zrotation  )  [static]
 

Definition at line 763 of file vecmath.h.

References cos(), and sin().

00764 {
00765     T c = (T) cos(angle);
00766     T s = (T) sin(angle);
00767 
00768     return Matrix3<T>(Vector3<T>(c, -s, 0),
00769                       Vector3<T>(s, c, 0),
00770                       Vector3<T>(0, 0, 1));
00771 }


Member Data Documentation

template<class T>
Vector3<T> Matrix3< T >::r[3]
 

Definition at line 163 of file vecmath.h.

Referenced by Matrix3< T >::column(), Matrix3< T >::determinant(), Matrix3< T >::inverse(), Matrix3< T >::Matrix3(), Matrix4< T >::Matrix4(), Matrix3< T >::operator *=(), Matrix3< T >::operator[](), Matrix3< T >::row(), and Matrix3< T >::transpose().


The documentation for this class was generated from the following file:
Generated on Sat Jan 14 22:33:27 2006 for Celestia by  doxygen 1.4.1