MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Matrix3D Class Reference

Implementation of a 3D matrix. More...

#include <Matrix.h>

Public Member Functions

 Matrix3D (void)
 
 Matrix3D (const Mdouble xx, const Mdouble xy, const Mdouble xz, const Mdouble yx, const Mdouble yy, const Mdouble yz, const Mdouble zx, const Mdouble zy, const Mdouble zz)
 
void set_zero ()
 
Mdouble trace () const
 
Matrix3D operator+ (const Matrix3D &A) const
 
Matrix3D operator- (const Matrix3D &A) const
 
Matrix3D operator+ (const Mdouble A) const
 
Matrix3D operator- (const Mdouble A) const
 
Matrix3D operator* (const Mdouble A) const
 
Vec3D operator* (const Vec3D A) const
 
Matrix3D operator/ (const Mdouble A) const
 
Matrix3Doperator+= (const Matrix3D &A)
 
Matrix3Doperator-= (const Matrix3D &A)
 
Matrix3Doperator/= (const Mdouble A)
 

Public Attributes

Mdouble XX
 
Mdouble XY
 
Mdouble XZ
 
Mdouble YX
 
Mdouble YY
 
Mdouble YZ
 
Mdouble ZX
 
Mdouble ZY
 
Mdouble ZZ
 

Friends

Vec3D operator* (const Matrix3D A, const Vec3D B)
 
std::ostream & operator<< (std::ostream &os, const Matrix3D &A)
 
std::istream & operator>> (std::istream &is, Matrix3D &A)
 
Matrix3D square (const Matrix3D &A)
 
Matrix3D sqrt (const Matrix3D &A)
 

Detailed Description

Implementation of a 3D matrix.

Definition at line 35 of file Matrix.h.

Constructor & Destructor Documentation

Matrix3D::Matrix3D ( void  )
inline

Definition at line 41 of file Matrix.h.

Referenced by operator*(), operator+(), operator-(), and operator/().

41 {}
Matrix3D::Matrix3D ( const Mdouble  xx,
const Mdouble  xy,
const Mdouble  xz,
const Mdouble  yx,
const Mdouble  yy,
const Mdouble  yz,
const Mdouble  zx,
const Mdouble  zy,
const Mdouble  zz 
)
inline

Definition at line 43 of file Matrix.h.

References XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

44  {
45  XX = xx; XY = xy; XZ = xz;
46  YX = yx; YY = yy; YZ = yz;
47  ZX = zx; ZY = zy; ZZ = zz;
48  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39

Member Function Documentation

Matrix3D Matrix3D::operator* ( const Mdouble  A) const
inline

Definition at line 95 of file Matrix.h.

References Matrix3D(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

96  {
97  return Matrix3D(XX * A, XY * A, XZ * A,
98  YX * A, YY * A, YZ * A,
99  ZX * A, ZY * A, ZZ * A);
100  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Vec3D Matrix3D::operator* ( const Vec3D  A) const
inline

Definition at line 102 of file Matrix.h.

References Vec3D::X, XX, XY, XZ, Vec3D::Y, YX, YY, YZ, Vec3D::Z, ZX, ZY, and ZZ.

103  {
104  return Vec3D(XX * A.X + XY * A.Y + XZ * A.Z,
105  YX * A.X + YY * A.Y + YZ * A.Z,
106  ZX * A.X + ZY * A.Y + ZZ * A.Z );
107  }
Mdouble XY
Definition: Matrix.h:39
Mdouble X
Definition: Vector.h:44
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble Y
Definition: Vector.h:44
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
Matrix3D Matrix3D::operator+ ( const Matrix3D A) const
inline

Definition at line 60 of file Matrix.h.

References Matrix3D(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

61  {
62  return Matrix3D(XX + A.XX, XY + A.XY, XZ + A.XZ,
63  YX + A.YX, YY + A.YY, YZ + A.YZ,
64  ZX + A.ZX, ZY + A.ZY, ZZ + A.ZZ);
65  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D Matrix3D::operator+ ( const Mdouble  A) const
inline

Definition at line 74 of file Matrix.h.

References Matrix3D(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

75  {
76  return Matrix3D(XX + A, XY + A, XZ + A,
77  YX + A, YY + A, YZ + A,
78  ZX + A, ZY + A, ZZ + A);
79  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D& Matrix3D::operator+= ( const Matrix3D A)
inline

Definition at line 130 of file Matrix.h.

References XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

131  {
132  XX += A.XX;
133  XY += A.XY;
134  XZ += A.XZ;
135  YX += A.YX;
136  YY += A.YY;
137  YZ += A.YZ;
138  ZX += A.ZX;
139  ZY += A.ZY;
140  ZZ += A.ZZ;
141  return *this;
142  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D Matrix3D::operator- ( const Matrix3D A) const
inline

Definition at line 67 of file Matrix.h.

References Matrix3D(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

68  {
69  return Matrix3D(XX - A.XX, XY - A.XY, XZ - A.XZ,
70  YX - A.YX, YY - A.YY, YZ - A.YZ,
71  ZX - A.ZX, ZY - A.ZY, ZZ - A.ZZ);
72  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D Matrix3D::operator- ( const Mdouble  A) const
inline

Definition at line 81 of file Matrix.h.

References Matrix3D(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

82  {
83  return Matrix3D(XX - A, XY - A, XZ - A,
84  YX - A, YY - A, YZ - A,
85  ZX - A, ZY - A, ZZ - A);
86  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D& Matrix3D::operator-= ( const Matrix3D A)
inline

Definition at line 144 of file Matrix.h.

References XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

145  {
146  XX -= A.XX;
147  XY -= A.XY;
148  XZ -= A.XZ;
149  YX -= A.YX;
150  YY -= A.YY;
151  YZ -= A.YZ;
152  ZX -= A.ZX;
153  ZY -= A.ZY;
154  ZZ -= A.ZZ;
155  return *this;
156  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D Matrix3D::operator/ ( const Mdouble  A) const
inline

Definition at line 109 of file Matrix.h.

References Matrix3D(), XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

110  {
111  return Matrix3D(XX / A, XY / A, XZ / A,
112  YX / A, YY / A, YZ / A,
113  ZX / A, ZY / A, ZZ / A);
114  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D& Matrix3D::operator/= ( const Mdouble  A)
inline

Definition at line 158 of file Matrix.h.

References A, XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

159  {
160  XX /= A;
161  XY /= A;
162  XZ /= A;
163  YX /= A;
164  YY /= A;
165  YZ /= A;
166  ZX /= A;
167  ZY /= A;
168  ZZ /= A;
169  return *this;
170  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
void Matrix3D::set_zero ( )
inline

Definition at line 50 of file Matrix.h.

References XX, XY, XZ, YX, YY, YZ, ZX, ZY, and ZZ.

51  {
52  XX = XY = XZ = YX = YY = YZ = ZX = ZY = ZZ = 0.0;
53  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Mdouble Matrix3D::trace ( ) const
inline

Definition at line 55 of file Matrix.h.

References XX, YY, and ZZ.

56  {
57  return (XX+YY+ZZ)/3;
58  }
Mdouble ZZ
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39

Friends And Related Function Documentation

Vec3D operator* ( const Matrix3D  A,
const Vec3D  B 
)
friend

Definition at line 88 of file Matrix.h.

89  {
90  return Vec3D(A.XX*B.X+A.XY*B.Y+A.XZ*B.Z,
91  A.YX*B.X+A.YY*B.Y+A.YZ*B.Z,
92  A.ZX*B.X+A.ZY*B.Y+A.ZZ*B.Z);
93  }
Mdouble XY
Definition: Matrix.h:39
Mdouble X
Definition: Vector.h:44
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble Y
Definition: Vector.h:44
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
std::ostream& operator<< ( std::ostream &  os,
const Matrix3D A 
)
friend

Definition at line 116 of file Matrix.h.

117  {
118  os << A.XX << ' ' << A.XY << ' ' << A.XZ << ' '
119  << A.YX << ' ' << A.YY << ' ' << A.YZ << ' '
120  << A.ZX << ' ' << A.ZY << ' ' << A.ZZ;
121  return os;
122  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
std::istream& operator>> ( std::istream &  is,
Matrix3D A 
)
friend

Definition at line 124 of file Matrix.h.

125  {
126  is >> A.XX >> A.XY >> A.XZ >> A.YX >> A.YY >> A.YZ >> A.ZX >> A.ZY >> A.ZZ;
127  return is;
128  }
Mdouble XY
Definition: Matrix.h:39
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D sqrt ( const Matrix3D A)
friend

Definition at line 181 of file Matrix.h.

182  {
183  return Matrix3D(sqrt(A.XX), sqrt(A.XY), sqrt(A.XZ),
184  sqrt(A.YX), sqrt(A.YY), sqrt(A.YZ),
185  sqrt(A.ZX), sqrt(A.ZY), sqrt(A.ZZ));
186  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
friend Matrix3D sqrt(const Matrix3D &A)
Definition: Matrix.h:181
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39
Matrix3D square ( const Matrix3D A)
friend

Definition at line 173 of file Matrix.h.

174  {
175  return Matrix3D(sqr(A.XX), sqr(A.XY), sqr(A.XZ),
176  sqr(A.YX), sqr(A.YY), sqr(A.YZ),
177  sqr(A.ZX), sqr(A.ZY), sqr(A.ZZ));
178  }
Mdouble XY
Definition: Matrix.h:39
Matrix3D(void)
Definition: Matrix.h:41
Mdouble ZY
Definition: Matrix.h:39
Mdouble XZ
Definition: Matrix.h:39
Mdouble ZX
Definition: Matrix.h:39
#define sqr(a)
Definition: ExtendedMath.h:36
Mdouble ZZ
Definition: Matrix.h:39
Mdouble YZ
Definition: Matrix.h:39
Mdouble YX
Definition: Matrix.h:39
Mdouble XX
Definition: Matrix.h:39
Mdouble YY
Definition: Matrix.h:39

Member Data Documentation


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