OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
ossimMatrix4x4 Class Reference

#include <ossimMatrix4x4.h>

Public Member Functions

 ossimMatrix4x4 ()
 
 ossimMatrix4x4 (const NEWMAT::Matrix &m)
 
 ossimMatrix4x4 (double v00, double v01, double v02, double v03, double v10, double v11, double v12, double v13, double v20, double v21, double v22, double v23, double v30, double v31, double v32, double v33)
 
 ossimMatrix4x4 (const ossim::Quaternion &quat)
 
 ossimMatrix4x4 (const ossimMatrix4x4 &rhs)
 
void makeRotate (const ossim::Quaternion &quat)
 
void setRotate (const ossim::Quaternion &quat)
 
ossim::Quaternion getRotate () const
 
void getRotate (ossim::Quaternion &quat) const
 
ossimMatrix4x4 operator+ (const ossimMatrix4x4 &rhs) const
 
ossimMatrix4x4 operator- (const ossimMatrix4x4 &rhs) const
 
ossimColumnVector4d rotateOnly (const ossimColumnVector4d &rhs) const
 
ossimColumnVector3d rotateOnly (const ossimColumnVector3d &rhs) const
 
ossimMatrix4x4 operator* (double scalar) const
 
ossimMatrix4x4 operator* (const ossimMatrix4x4 &rhs) const
 
ossimMatrix4x4i ()
 
ossimMatrix4x4t ()
 
double getDeterminant () const
 
ossimColumnVector3d getEigenValues () const
 
bool isEqualTo (const ossimMatrix4x4 &rhs, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
void setZero ()
 
void setIdentity ()
 
const NEWMAT::Matrix & getData () const
 
NEWMAT::Matrix & getData ()
 

Static Public Member Functions

static NEWMAT::Matrix createIdentity ()
 
static NEWMAT::Matrix createRotateOnly (const ossimMatrix4x4 &aMatrix)
 
static NEWMAT::Matrix createZero ()
 
static NEWMAT::Matrix createTranslationMatrix (double x, double y, double z)
 
static NEWMAT::Matrix createRotationMatrix (double angleX, double angleY, double angleZ, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
 
static NEWMAT::Matrix createRotationXMatrix (double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
 
static NEWMAT::Matrix createRotationYMatrix (double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
 
static NEWMAT::Matrix createRotationZMatrix (double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
 
static NEWMAT::Matrix createScaleMatrix (double X, double Y, double Z)
 

Private Attributes

NEWMAT::Matrix theData
 

Friends

std::ostream & operator<< (std::ostream &out, const ossimMatrix4x4 &data)
 
ossimColumnVector4d operator* (const ossimMatrix4x4 &lhs, const ossimColumnVector4d &rhs)
 
ossimColumnVector3d operator* (const ossimMatrix4x4 &lhs, const ossimColumnVector3d &rhs)
 

Detailed Description

Definition at line 21 of file ossimMatrix4x4.h.

Constructor & Destructor Documentation

◆ ossimMatrix4x4() [1/5]

ossimMatrix4x4::ossimMatrix4x4 ( )

Definition at line 70 of file ossimMatrix4x4.cpp.

References theData.

71  :theData(4, 4)
72 {
73  theData[0][0] = 1.0;
74  theData[0][1] = 0.0;
75  theData[0][2] = 0.0;
76  theData[0][3] = 0.0;
77 
78  theData[1][0] = 0.0;
79  theData[1][1] = 1.0;
80  theData[1][2] = 0.0;
81  theData[1][3] = 0.0;
82 
83  theData[2][0] = 0.0;
84  theData[2][1] = 0.0;
85  theData[2][2] = 1.0;
86  theData[2][3] = 0.0;
87 
88  theData[3][0] = 0.0;
89  theData[3][1] = 0.0;
90  theData[3][2] = 0.0;
91  theData[3][3] = 1.0;
92 }
NEWMAT::Matrix theData

◆ ossimMatrix4x4() [2/5]

ossimMatrix4x4::ossimMatrix4x4 ( const NEWMAT::Matrix &  m)

Definition at line 18 of file ossimMatrix4x4.cpp.

References theData.

19  :theData(4,4)
20 {
21  if((m.Nrows() == 4) &&
22  (m.Ncols() == 4))
23  {
24  theData = m;
25  }
26  else if((m.Nrows()==3)&&
27  (m.Ncols()==3))
28  {
29  theData[0][0] = m[0][0];
30  theData[0][1] = m[0][1];
31  theData[0][2] = m[0][2];
32  theData[0][3] = 0.0;
33  theData[1][0] = m[1][0];
34  theData[1][1] = m[1][1];
35  theData[1][2] = m[1][2];
36  theData[1][3] = 0.0;
37  theData[2][0] = m[2][0];
38  theData[2][1] = m[2][1];
39  theData[2][2] = m[2][2];
40  theData[2][3] = 0.0;
41  theData[3][0] = 0.0;
42  theData[3][1] = 0.0;
43  theData[3][2] = 0.0;
44  theData[3][3] = 1.0;
45  }
46  else
47  {
48  theData[0][0] = 1.0;
49  theData[0][1] = 0.0;
50  theData[0][2] = 0.0;
51  theData[0][3] = 0.0;
52 
53  theData[1][0] = 0.0;
54  theData[1][1] = 1.0;
55  theData[1][2] = 0.0;
56  theData[1][3] = 0.0;
57 
58  theData[2][0] = 0.0;
59  theData[2][1] = 0.0;
60  theData[2][2] = 1.0;
61  theData[2][3] = 0.0;
62 
63  theData[3][0] = 0.0;
64  theData[3][1] = 0.0;
65  theData[3][2] = 0.0;
66  theData[3][3] = 1.0;
67  }
68 }
NEWMAT::Matrix theData

◆ ossimMatrix4x4() [3/5]

ossimMatrix4x4::ossimMatrix4x4 ( double  v00,
double  v01,
double  v02,
double  v03,
double  v10,
double  v11,
double  v12,
double  v13,
double  v20,
double  v21,
double  v22,
double  v23,
double  v30,
double  v31,
double  v32,
double  v33 
)

Definition at line 94 of file ossimMatrix4x4.cpp.

References theData.

98  :theData(4, 4)
99 {
100  theData[0][0] = v00;
101  theData[0][1] = v01;
102  theData[0][2] = v02;
103  theData[0][3] = v03;
104 
105  theData[1][0] = v10;
106  theData[1][1] = v11;
107  theData[1][2] = v12;
108  theData[1][3] = v13;
109 
110  theData[2][0] = v20;
111  theData[2][1] = v21;
112  theData[2][2] = v22;
113  theData[2][3] = v23;
114 
115  theData[3][0] = v30;
116  theData[3][1] = v31;
117  theData[3][2] = v32;
118  theData[3][3] = v33;
119 }
NEWMAT::Matrix theData

◆ ossimMatrix4x4() [4/5]

ossimMatrix4x4::ossimMatrix4x4 ( const ossim::Quaternion quat)
inlineexplicit

Definition at line 35 of file ossimMatrix4x4.h.

35 { makeRotate(quat);}
void makeRotate(const ossim::Quaternion &quat)

◆ ossimMatrix4x4() [5/5]

ossimMatrix4x4::ossimMatrix4x4 ( const ossimMatrix4x4 rhs)
inline

Definition at line 36 of file ossimMatrix4x4.h.

References theData.

37  :theData(4,4)
38  {
39  theData[0][0] = rhs.theData[0][0];
40  theData[0][1] = rhs.theData[0][1];
41  theData[0][2] = rhs.theData[0][2];
42  theData[0][3] = rhs.theData[0][3];
43  theData[1][0] = rhs.theData[1][0];
44  theData[1][1] = rhs.theData[1][1];
45  theData[1][2] = rhs.theData[1][2];
46  theData[1][3] = rhs.theData[1][3];
47  theData[2][0] = rhs.theData[2][0];
48  theData[2][1] = rhs.theData[2][1];
49  theData[2][2] = rhs.theData[2][2];
50  theData[2][3] = rhs.theData[2][3];
51  theData[3][0] = rhs.theData[3][0];
52  theData[3][1] = rhs.theData[3][1];
53  theData[3][2] = rhs.theData[3][2];
54  theData[3][3] = rhs.theData[3][3];
55  }
NEWMAT::Matrix theData

Member Function Documentation

◆ createIdentity()

NEWMAT::Matrix ossimMatrix4x4::createIdentity ( )
static

◆ createRotateOnly()

NEWMAT::Matrix ossimMatrix4x4::createRotateOnly ( const ossimMatrix4x4 aMatrix)
static

Definition at line 288 of file ossimMatrix4x4.cpp.

References getData(), and theData.

289 {
290  ossimMatrix4x4 m = aMatrix;
291 
292  m.theData[0][3] = 0;
293  m.theData[1][3] = 0;
294  m.theData[2][3] = 0;
295  m.theData[3][3] = 1.0;
296 
297  m.theData[3][0] = 0.0;
298  m.theData[3][1] = 0.0;
299  m.theData[3][2] = 0.0;
300  m.theData[3][3] = 1.0;
301 
302  return m.getData();
303 }
const NEWMAT::Matrix & getData() const
NEWMAT::Matrix theData

◆ createRotationMatrix()

NEWMAT::Matrix ossimMatrix4x4::createRotationMatrix ( double  angleX,
double  angleY,
double  angleZ,
ossimCoordSysOrientMode  orientationMode = OSSIM_RIGHT_HANDED 
)
static

Definition at line 326 of file ossimMatrix4x4.cpp.

References createRotationXMatrix(), createRotationYMatrix(), and createRotationZMatrix().

330 {
331  return (createRotationZMatrix(angleZ,
332  orientationMode)*
333  createRotationYMatrix(angleY,
334  orientationMode)*
335  createRotationXMatrix(angleX,
336  orientationMode));
337 }
static NEWMAT::Matrix createRotationYMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
static NEWMAT::Matrix createRotationXMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)
static NEWMAT::Matrix createRotationZMatrix(double angle, ossimCoordSysOrientMode orientationMode=OSSIM_RIGHT_HANDED)

◆ createRotationXMatrix()

NEWMAT::Matrix ossimMatrix4x4::createRotationXMatrix ( double  angle,
ossimCoordSysOrientMode  orientationMode = OSSIM_RIGHT_HANDED 
)
static

Definition at line 339 of file ossimMatrix4x4.cpp.

References OSSIM_RIGHT_HANDED, and RAD_PER_DEG.

Referenced by createRotationMatrix(), ossimSpectraboticsRedEdgeModel::updateModel(), ossimApplanixEcefModel::updateModel(), and ossimSonomaSensor::updateModel().

341 {
342  NEWMAT::Matrix m(4,4);
343 
344  double Cosine = cos(angle*RAD_PER_DEG);
345  double Sine = sin(angle*RAD_PER_DEG);
346 
347  if(orientationMode == OSSIM_RIGHT_HANDED)
348  {
349  m << 1.0 << 0.0 << 0.0 << 0.0
350  << 0.0 << Cosine << Sine << 0.0
351  << 0.0 << -Sine << Cosine << 0.0
352  << 0.0 << 0.0 << 0.0 << 1.0;
353  }
354  else
355  {
356  m << 1.0 << 0.0 << 0.0 << 0.0
357  << 0.0 << Cosine << -Sine << 0.0
358  << 0.0 << Sine << Cosine << 0.0
359  << 0.0 << 0.0 << 0.0 << 1.0;
360  }
361 
362  return m;
363 }
#define RAD_PER_DEG

◆ createRotationYMatrix()

NEWMAT::Matrix ossimMatrix4x4::createRotationYMatrix ( double  angle,
ossimCoordSysOrientMode  orientationMode = OSSIM_RIGHT_HANDED 
)
static

Definition at line 365 of file ossimMatrix4x4.cpp.

References OSSIM_RIGHT_HANDED, and RAD_PER_DEG.

Referenced by createRotationMatrix(), ossimSpectraboticsRedEdgeModel::updateModel(), and ossimApplanixEcefModel::updateModel().

367 {
368  NEWMAT::Matrix m(4,4);
369 
370  double Cosine = cos(angle*RAD_PER_DEG);
371  double Sine = sin(angle*RAD_PER_DEG);
372 
373  if(orientationMode == OSSIM_RIGHT_HANDED)
374  {
375  m << Cosine << 0.0 << -Sine << 0.0
376  << 0.0 << 1.0 << 0.0 << 0.0
377  << Sine << 0.0 << Cosine << 0.0
378  << 0.0 << 0.0 << 0.0 << 1.0;
379  }
380  else
381  {
382  m << Cosine << 0.0 << Sine << 0.0
383  << 0.0 << 1.0 << 0.0 << 0.0
384  << -Sine << 0.0 << Cosine << 0.0
385  << 0.0 << 0.0 << 0.0 << 1.0;
386  }
387 
388  return m;
389 }
#define RAD_PER_DEG

◆ createRotationZMatrix()

NEWMAT::Matrix ossimMatrix4x4::createRotationZMatrix ( double  angle,
ossimCoordSysOrientMode  orientationMode = OSSIM_RIGHT_HANDED 
)
static

Definition at line 392 of file ossimMatrix4x4.cpp.

References OSSIM_RIGHT_HANDED, and RAD_PER_DEG.

Referenced by createRotationMatrix(), ossimSpectraboticsRedEdgeModel::updateModel(), and ossimSonomaSensor::updateModel().

394 {
395  NEWMAT::Matrix m(4,4);
396 
397  double Cosine = cos(angle*RAD_PER_DEG);
398  double Sine = sin(angle*RAD_PER_DEG);
399 
400  if(orientationMode == OSSIM_RIGHT_HANDED)
401  {
402  m << Cosine << Sine << 0.0 << 0.0
403  << -Sine << Cosine << 0.0 << 0.0
404  << 0.0 << 0.0 << 1.0 << 0.0
405  << 0.0 << 0.0 << 0.0 << 1.0;
406  }
407  else
408  {
409  m << Cosine << -Sine << 0.0 << 0.0
410  << Sine << Cosine << 0.0 << 0.0
411  << 0.0 << 0.0 << 1.0 << 0.0
412  << 0.0 << 0.0 << 0.0 << 1.0;
413  }
414 
415  return m;
416 }
#define RAD_PER_DEG

◆ createScaleMatrix()

NEWMAT::Matrix ossimMatrix4x4::createScaleMatrix ( double  X,
double  Y,
double  Z 
)
static

Definition at line 419 of file ossimMatrix4x4.cpp.

References x, and y.

420 {
421  NEWMAT::Matrix m(4, 4);
422 
423  m << x << 0.0 << 0.0 << 0.0
424  << 0.0 << y << 0.0 << 0.0
425  << 0.0 << 0.0 << z << 0.0
426  << 0.0 << 0.0 << 0.0 << 1.0;
427 
428  return m;
429 }
ossim_uint32 x
ossim_uint32 y

◆ createTranslationMatrix()

NEWMAT::Matrix ossimMatrix4x4::createTranslationMatrix ( double  x,
double  y,
double  z 
)
static

Definition at line 314 of file ossimMatrix4x4.cpp.

References getData(), x, and y.

Referenced by ossimSonomaSensor::updateModel().

317 {
318  ossimMatrix4x4 m(1.0, 0.0, 0.0, x,
319  0.0, 1.0, 0.0, y,
320  0.0, 0.0, 1.0, z,
321  0.0, 0.0, 0.0, 1.0);
322 
323  return m.getData();
324 }
ossim_uint32 x
ossim_uint32 y

◆ createZero()

NEWMAT::Matrix ossimMatrix4x4::createZero ( )
static

Definition at line 305 of file ossimMatrix4x4.cpp.

References getData().

306 {
307  ossimMatrix4x4 m;
308 
309  m.getData() = 0.0;
310 
311  return m.getData();
312 }
const NEWMAT::Matrix & getData() const

◆ getData() [1/2]

const NEWMAT::Matrix& ossimMatrix4x4::getData ( ) const
inline

◆ getData() [2/2]

NEWMAT::Matrix& ossimMatrix4x4::getData ( )
inline

Definition at line 275 of file ossimMatrix4x4.h.

275 {return theData;}
NEWMAT::Matrix theData

◆ getDeterminant()

double ossimMatrix4x4::getDeterminant ( ) const
inline

uses the matrix package to compute the determinant

Definition at line 238 of file ossimMatrix4x4.h.

239  {
240  return theData.Determinant();
241  }
NEWMAT::Matrix theData

◆ getEigenValues()

ossimColumnVector3d ossimMatrix4x4::getEigenValues ( ) const

Uses the matrix package to compute the eigenvalues for this matrix

Definition at line 234 of file ossimMatrix4x4.cpp.

References EigenValues(), and theData.

235 {
236  NEWMAT::DiagonalMatrix d;
237  NEWMAT::SymmetricMatrix s;
238 
239  s << theData;
240 
241  NEWMAT::EigenValues(s, d);
242 
243  return ossimColumnVector3d(d[0], d[1], d[2]);
244 }
void EigenValues(const SymmetricMatrix &, DiagonalMatrix &)
Definition: evalue.cpp:286
NEWMAT::Matrix theData

◆ getRotate() [1/2]

ossim::Quaternion ossimMatrix4x4::getRotate ( ) const

Definition at line 176 of file ossimMatrix4x4.cpp.

Referenced by ossim::Quaternion::set().

177 {
178  ossim::Quaternion quat;
179 
180  getRotate(quat);
181 
182  return quat;
183 }
ossim::Quaternion getRotate() const
A quaternion class.

◆ getRotate() [2/2]

void ossimMatrix4x4::getRotate ( ossim::Quaternion quat) const

Definition at line 185 of file ossimMatrix4x4.cpp.

References i(), QW, QX, QY, QZ, and theData.

186 {
187  ossim_float64 tr, s;
188  ossim_float64 tq[4];
189  int i, j, k;
190 
191  int nxt[3] = {1, 2, 0};
192 
193  tr = theData[0][0] + theData[1][1] + theData[2][2]+1.0;
194 
195  // check the diagonal
196  if (tr > 0.0)
197  {
198  s = (ossim_float64)std::sqrt (tr);
199  QW = s / 2.0;
200  s = 0.5 / s;
201  QX = (theData[2][1] - theData[1][2]) * s;
202  QY = (theData[0][2] - theData[2][0]) * s;
203  QZ = (theData[1][0] - theData[0][1]) * s;
204  }
205  else
206  {
207  // diagonal is negative
208  i = 0;
209  if (theData[1][1] > theData[0][0])
210  i = 1;
211  if (theData[2][2] > theData[i][i])
212  i = 2;
213  j = nxt[i];
214  k = nxt[j];
215 
216  s = (ossim_float64)std::sqrt((theData[i][i] - (theData[j][j] + theData[k][k])) + 1.0);
217 
218  tq[i] = s * 0.5;
219 
220  if (s != 0.0)
221  s = 0.5 / s;
222 
223  tq[3] = (theData[k][j] - theData[j][k]) * s;
224  tq[j] = (theData[j][i] + theData[i][j]) * s;
225  tq[k] = (theData[k][i] + theData[i][k]) * s;
226 
227  QX = tq[0];
228  QY = tq[1];
229  QZ = tq[2];
230  QW = tq[3];
231  }
232 }
ossimMatrix4x4 & i()
NEWMAT::Matrix theData
#define QW
double ossim_float64
#define QX
#define QY
#define QZ

◆ i()

ossimMatrix4x4& ossimMatrix4x4::i ( )
inline

uses the matrix package to compute the inverse

Definition at line 218 of file ossimMatrix4x4.h.

References i().

Referenced by ossimMapProjection::applyScale(), getRotate(), and i().

219  {
220  theData = theData.i();
221 
222  return *this;
223  }
NEWMAT::Matrix theData

◆ isEqualTo()

bool ossimMatrix4x4::isEqualTo ( const ossimMatrix4x4 rhs,
ossimCompareType  compareType = OSSIM_COMPARE_FULL 
) const
inline

Definition at line 282 of file ossimMatrix4x4.h.

References ossim::almostEqual(), and theData.

Referenced by ossimMapProjection::isEqualTo().

284 {
285  return (ossim::almostEqual(theData[0][0], rhs.theData[0][0])&&
286  ossim::almostEqual(theData[0][1], rhs.theData[0][1])&&
287  ossim::almostEqual(theData[0][2], rhs.theData[0][2])&&
288  ossim::almostEqual(theData[0][3], rhs.theData[0][3])&&
289  ossim::almostEqual(theData[1][0], rhs.theData[1][0])&&
290  ossim::almostEqual(theData[1][1], rhs.theData[1][1])&&
291  ossim::almostEqual(theData[1][2], rhs.theData[1][2])&&
292  ossim::almostEqual(theData[1][3], rhs.theData[1][3])&&
293  ossim::almostEqual(theData[2][0], rhs.theData[2][0])&&
294  ossim::almostEqual(theData[2][1], rhs.theData[2][1])&&
295  ossim::almostEqual(theData[2][2], rhs.theData[2][2])&&
296  ossim::almostEqual(theData[2][3], rhs.theData[2][3])&&
297  ossim::almostEqual(theData[3][0], rhs.theData[3][0])&&
298  ossim::almostEqual(theData[3][1], rhs.theData[3][1])&&
299  ossim::almostEqual(theData[3][2], rhs.theData[3][2])&&
300  ossim::almostEqual(theData[3][3], rhs.theData[3][3]));
301 }
NEWMAT::Matrix theData
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
Definition: ossimCommon.h:53

◆ makeRotate()

void ossimMatrix4x4::makeRotate ( const ossim::Quaternion quat)

Definition at line 124 of file ossimMatrix4x4.cpp.

References setIdentity(), and setRotate().

Referenced by ossim::Quaternion::get().

125 {
126  setIdentity();
127  setRotate(quat);
128 }
void setRotate(const ossim::Quaternion &quat)

◆ operator*() [1/2]

ossimMatrix4x4 ossimMatrix4x4::operator* ( double  scalar) const
inline

Definition at line 104 of file ossimMatrix4x4.h.

105  {
106  return ossimMatrix4x4(theData[0][0]*scalar, theData[0][1]*scalar, theData[0][2]*scalar, theData[0][3]*scalar,
107  theData[1][0]*scalar, theData[1][1]*scalar, theData[1][2]*scalar, theData[1][3]*scalar,
108  theData[2][0]*scalar, theData[2][1]*scalar, theData[2][2]*scalar, theData[2][3]*scalar,
109  theData[0][0]*scalar, theData[0][1]*scalar, theData[0][2]*scalar, theData[0][3]*scalar);
110 
111  }
NEWMAT::Matrix theData

◆ operator*() [2/2]

ossimMatrix4x4 ossimMatrix4x4::operator* ( const ossimMatrix4x4 rhs) const
inline

Definition at line 112 of file ossimMatrix4x4.h.

References theData.

113  {
114  ossimMatrix4x4 m;
115 
116  // element 0,0 is first row time first column
117  m.theData[0][0] = (theData[0][0]*rhs.theData[0][0] +
118  theData[0][1]*rhs.theData[1][0] +
119  theData[0][2]*rhs.theData[2][0] +
120  theData[0][3]*rhs.theData[3][0]);
121 
122  // element 0, 1 is first row second column
123  m.theData[0][1] = (theData[0][0]*rhs.theData[0][1] +
124  theData[0][1]*rhs.theData[1][1] +
125  theData[0][2]*rhs.theData[2][1] +
126  theData[0][3]*rhs.theData[3][1]);
127 
128  // element 0, 2 is first row third column
129  m.theData[0][2] = (theData[0][0]*rhs.theData[0][2] +
130  theData[0][1]*rhs.theData[1][2] +
131  theData[0][2]*rhs.theData[2][2] +
132  theData[0][3]*rhs.theData[3][2]);
133 
134  // element 0, 3 is first row fourth column
135  m.theData[0][3] = (theData[0][0]*rhs.theData[0][3] +
136  theData[0][1]*rhs.theData[1][3] +
137  theData[0][2]*rhs.theData[2][3] +
138  theData[0][3]*rhs.theData[3][3]);
139 
140  // element 1, 0 is second row first column
141  m.theData[1][0] = (theData[1][0]*rhs.theData[0][0] +
142  theData[1][1]*rhs.theData[1][0] +
143  theData[1][2]*rhs.theData[2][0] +
144  theData[1][3]*rhs.theData[3][0]);
145 
146  // element 1, 1 is second row second column
147  m.theData[1][1] = (theData[1][0]*rhs.theData[0][1] +
148  theData[1][1]*rhs.theData[1][1] +
149  theData[1][2]*rhs.theData[2][1] +
150  theData[1][3]*rhs.theData[3][1]);
151 
152  // element 1, 2 is second row third column
153  m.theData[1][2] = (theData[1][0]*rhs.theData[0][2] +
154  theData[1][1]*rhs.theData[1][2] +
155  theData[1][2]*rhs.theData[2][2] +
156  theData[1][3]*rhs.theData[3][2]);
157 
158  // element 1, 3 is second row fourth column
159  m.theData[1][3] = (theData[1][0]*rhs.theData[0][3] +
160  theData[1][1]*rhs.theData[1][3] +
161  theData[1][2]*rhs.theData[2][3] +
162  theData[1][3]*rhs.theData[3][3]);
163 
164  // element 2, 0 is third row first column
165  m.theData[2][0] = (theData[2][0]*rhs.theData[0][0] +
166  theData[2][1]*rhs.theData[1][0] +
167  theData[2][2]*rhs.theData[2][0] +
168  theData[2][3]*rhs.theData[3][0]);
169 
170  // element 2, 1 is third row second column
171  m.theData[2][1] = (theData[2][0]*rhs.theData[0][1] +
172  theData[2][1]*rhs.theData[1][1] +
173  theData[2][2]*rhs.theData[2][1] +
174  theData[2][3]*rhs.theData[3][1]);
175 
176  // element 2, 2 is third row third column
177  m.theData[2][2] = (theData[2][0]*rhs.theData[0][2] +
178  theData[2][1]*rhs.theData[1][2] +
179  theData[2][2]*rhs.theData[2][2] +
180  theData[2][3]*rhs.theData[3][2]);
181 
182  // element 2, 3 is third row fourth column
183  m.theData[2][3] = (theData[2][0]*rhs.theData[0][3] +
184  theData[2][1]*rhs.theData[1][3] +
185  theData[2][2]*rhs.theData[2][3] +
186  theData[2][3]*rhs.theData[3][3]);
187 
188  // element 3, 0 is fourth row first column
189  m.theData[3][0] = (theData[3][0]*rhs.theData[0][0] +
190  theData[3][1]*rhs.theData[1][0] +
191  theData[3][2]*rhs.theData[2][0] +
192  theData[3][3]*rhs.theData[3][0]);
193 
194  // element 3, 1 is fourth row second column
195  m.theData[3][1] = (theData[3][0]*rhs.theData[0][1] +
196  theData[3][1]*rhs.theData[1][1] +
197  theData[3][2]*rhs.theData[2][1] +
198  theData[3][3]*rhs.theData[3][1]);
199 
200  // element 3, 2 is fourth row third column
201  m.theData[3][2] = (theData[3][0]*rhs.theData[0][2] +
202  theData[3][1]*rhs.theData[1][2] +
203  theData[3][2]*rhs.theData[2][2] +
204  theData[3][3]*rhs.theData[3][2]);
205 
206  // element 3, 3 is fourth row fourth column
207  m.theData[3][3] = (theData[3][0]*rhs.theData[0][3] +
208  theData[3][1]*rhs.theData[1][3] +
209  theData[3][2]*rhs.theData[2][3] +
210  theData[3][3]*rhs.theData[3][3]);
211 
212  return m;
213  }
NEWMAT::Matrix theData

◆ operator+()

ossimMatrix4x4 ossimMatrix4x4::operator+ ( const ossimMatrix4x4 rhs) const
inline

Definition at line 61 of file ossimMatrix4x4.h.

References theData.

62  {
63  return ossimMatrix4x4(theData[0][0] + rhs.theData[0][0], theData[0][1] + rhs.theData[0][1], theData[0][2] + rhs.theData[0][2], theData[0][3] + rhs.theData[0][3],
64  theData[1][0] + rhs.theData[1][0], theData[1][1] + rhs.theData[1][1], theData[1][2] + rhs.theData[1][2], theData[1][3] + rhs.theData[1][3],
65  theData[2][0] + rhs.theData[2][0], theData[2][1] + rhs.theData[2][1], theData[2][2] + rhs.theData[2][2], theData[2][3] + rhs.theData[2][3],
66  theData[3][0] + rhs.theData[3][0], theData[3][1] + rhs.theData[3][1], theData[3][2] + rhs.theData[3][2], theData[3][3] + rhs.theData[3][3]);
67  }
NEWMAT::Matrix theData

◆ operator-()

ossimMatrix4x4 ossimMatrix4x4::operator- ( const ossimMatrix4x4 rhs) const
inline

Definition at line 68 of file ossimMatrix4x4.h.

References theData.

69  {
70  return ossimMatrix4x4(theData[0][0] - rhs.theData[0][0], theData[0][1] - rhs.theData[0][1], theData[0][2] - rhs.theData[0][2], theData[0][3] - rhs.theData[0][3],
71  theData[1][0] - rhs.theData[1][0], theData[1][1] - rhs.theData[1][1], theData[1][2] - rhs.theData[1][2], theData[1][3] - rhs.theData[1][3],
72  theData[2][0] - rhs.theData[2][0], theData[2][1] - rhs.theData[2][1], theData[2][2] - rhs.theData[2][2], theData[2][3] - rhs.theData[2][3],
73  theData[3][0] - rhs.theData[3][0], theData[3][1] - rhs.theData[3][1], theData[3][2] - rhs.theData[3][2], theData[3][3] - rhs.theData[3][3]);
74  }
NEWMAT::Matrix theData

◆ rotateOnly() [1/2]

ossimColumnVector4d ossimMatrix4x4::rotateOnly ( const ossimColumnVector4d rhs) const
inline

Definition at line 90 of file ossimMatrix4x4.h.

Referenced by ossimAxes::rotateAxes().

91  {
92  // multiply only by the 3x3 submatrix.
93  return ossimColumnVector4d( (theData[0][0]*rhs[0] + theData[0][1]*rhs[1] + theData[0][2]*rhs[2]),
94  (theData[1][0]*rhs[0] + theData[1][1]*rhs[1] + theData[1][2]*rhs[2]),
95  (theData[2][0]*rhs[0] + theData[2][1]*rhs[1] + theData[2][2]*rhs[2]));
96  }
NEWMAT::Matrix theData

◆ rotateOnly() [2/2]

ossimColumnVector3d ossimMatrix4x4::rotateOnly ( const ossimColumnVector3d rhs) const
inline

Definition at line 97 of file ossimMatrix4x4.h.

98  {
99  // assume the 4 coordinate (homogeneous coord) of the 3d vector is 1
100  return ossimColumnVector3d( (theData[0][0]*rhs[0] + theData[0][1]*rhs[1] + theData[0][2]*rhs[2]),
101  (theData[1][0]*rhs[0] + theData[1][1]*rhs[1] + theData[1][2]*rhs[2]),
102  (theData[2][0]*rhs[0] + theData[2][1]*rhs[1] + theData[2][2]*rhs[2]));
103  }
NEWMAT::Matrix theData

◆ setIdentity()

void ossimMatrix4x4::setIdentity ( )

Definition at line 269 of file ossimMatrix4x4.cpp.

References setZero(), and theData.

Referenced by makeRotate().

270 {
271  setZero();
272  theData[0][0] = 1.0;
273  theData[1][1] = 1.0;
274  theData[2][2] = 1.0;
275  theData[3][3] = 1.0;
276 }
NEWMAT::Matrix theData

◆ setRotate()

void ossimMatrix4x4::setRotate ( const ossim::Quaternion quat)

Definition at line 130 of file ossimMatrix4x4.cpp.

References ossim::Quaternion::length2(), QW, QX, QY, QZ, and theData.

Referenced by makeRotate().

131 {
132  ossim::Quaternion q(quat);
133  double length2 = q.length2();
134  if (length2!=1.0 && length2!=0)
135  {
136  // normalize quat if required.
137  q /= sqrt(length2);
138  }
139 
140  // Source: Gamasutra, Rotating Objects Using Quaternions
141  //
142  //http://www.gamasutra.com/features/19980703/quaternions_01.htm
143 
144  double wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2;
145 
146  // calculate coefficients
147  x2 = QX + QX;
148  y2 = QY + QY;
149  z2 = QZ + QZ;
150 
151  xx = QX * x2;
152  xy = QX * y2;
153  xz = QX * z2;
154 
155  yy = QY * y2;
156  yz = QY * z2;
157  zz = QZ * z2;
158 
159  wx = QW * x2;
160  wy = QW * y2;
161  wz = QW * z2;
162 
163  theData[0][0] = 1.0 - (yy + zz);
164  theData[0][1] = xy - wz;
165  theData[0][2] = xz + wy;
166 
167  theData[1][0] = xy + wz;
168  theData[1][1] = 1.0 - (xx + zz);
169  theData[1][2] = yz - wx;
170 
171  theData[2][0] = xz - wy;
172  theData[2][1] = yz + wx;
173  theData[2][2] = 1.0 - (xx + yy);
174 }
NEWMAT::Matrix theData
A quaternion class.
#define QW
#define QX
#define QY
#define QZ

◆ setZero()

void ossimMatrix4x4::setZero ( )

Definition at line 246 of file ossimMatrix4x4.cpp.

References theData.

Referenced by setIdentity().

247 {
248  theData[0][0] = 0.0;
249  theData[0][1] = 0.0;
250  theData[0][2] = 0.0;
251  theData[0][3] = 0.0;
252 
253  theData[1][0] = 0.0;
254  theData[1][1] = 0.0;
255  theData[1][2] = 0.0;
256  theData[1][3] = 0.0;
257 
258  theData[2][0] = 0.0;
259  theData[2][1] = 0.0;
260  theData[2][2] = 0.0;
261  theData[2][3] = 0.0;
262 
263  theData[3][0] = 0.0;
264  theData[3][1] = 0.0;
265  theData[3][2] = 0.0;
266  theData[3][3] = 0.0;
267 }
NEWMAT::Matrix theData

◆ t()

ossimMatrix4x4& ossimMatrix4x4::t ( )
inline

Uses the matrix package to compute the transpose.

Definition at line 228 of file ossimMatrix4x4.h.

References t().

Referenced by t().

229  {
230  theData = theData.t();
231 
232  return *this;
233  }
NEWMAT::Matrix theData

Friends And Related Function Documentation

◆ operator* [1/2]

ossimColumnVector4d operator* ( const ossimMatrix4x4 lhs,
const ossimColumnVector4d rhs 
)
friend

Definition at line 75 of file ossimMatrix4x4.h.

76  {
77  return ossimColumnVector4d( (lhs.theData[0][0]*rhs[0] + lhs.theData[0][1]*rhs[1] + lhs.theData[0][2]*rhs[2] + lhs.theData[0][3]*rhs[3]),
78  (lhs.theData[1][0]*rhs[0] + lhs.theData[1][1]*rhs[1] + lhs.theData[1][2]*rhs[2] + lhs.theData[1][3]*rhs[3]),
79  (lhs.theData[2][0]*rhs[0] + lhs.theData[2][1]*rhs[1] + lhs.theData[2][2]*rhs[2] + lhs.theData[2][3]*rhs[3]),
80  (lhs.theData[3][0]*rhs[0] + lhs.theData[3][1]*rhs[1] + lhs.theData[3][2]*rhs[2] + lhs.theData[3][3]*rhs[3]));
81 
82  }
NEWMAT::Matrix theData

◆ operator* [2/2]

ossimColumnVector3d operator* ( const ossimMatrix4x4 lhs,
const ossimColumnVector3d rhs 
)
friend

Definition at line 83 of file ossimMatrix4x4.h.

84  {
85  // assume the 4 coordinate (homogeneous coord) of the 3d vector is 1
86  return ossimColumnVector3d( (lhs.theData[0][0]*rhs[0] + lhs.theData[0][1]*rhs[1] + lhs.theData[0][2]*rhs[2] + lhs.theData[0][3]),
87  (lhs.theData[1][0]*rhs[0] + lhs.theData[1][1]*rhs[1] + lhs.theData[1][2]*rhs[2] + lhs.theData[1][3]),
88  (lhs.theData[2][0]*rhs[0] + lhs.theData[2][1]*rhs[1] + lhs.theData[2][2]*rhs[2] + lhs.theData[2][3]));
89  }
NEWMAT::Matrix theData

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const ossimMatrix4x4 data 
)
friend

Definition at line 24 of file ossimMatrix4x4.h.

26  {
27  return out << data.getData();
28  }
const NEWMAT::Matrix & getData() const

Member Data Documentation

◆ theData

NEWMAT::Matrix ossimMatrix4x4::theData
private

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