TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::Matrix4float64 Class Reference

#include <Matrix4.h>

Public Member Functions

 Matrix4float64 (const Matrix4 &m)
 
 Matrix4float64 ()
 
 Matrix4float64 (double r1c1, double r1c2, double r1c3, double r1c4, double r2c1, double r2c2, double r2c3, double r2c4, double r3c1, double r3c2, double r3c3, double r3c4, double r4c1, double r4c2, double r4c3, double r4c4)
 
bool operator!= (const Matrix4float64 &other) const
 
bool operator== (const Matrix4float64 &other) const
 
Vector4 operator* (const Vector4 &vector) const
 
double * operator[] (int r)
 
const double * operator[] (int r) const
 
 operator double * ()
 
 operator const double * () const
 

Static Public Member Functions

static const Matrix4float64identity ()
 
static const Matrix4float64zero ()
 
static Matrix4float64 perspectiveProjection (double left, double right, double bottom, double top, double nearval, double farval, float upDirection=-1.0f)
 

Private Attributes

double elt [4][4]
 

Detailed Description

Double-precision 4x4 matrix

Constructor & Destructor Documentation

G3D::Matrix4float64::Matrix4float64 ( const Matrix4 m)
explicit
553  {
554  for (int r = 0; r < 4; ++r) {
555  for (int c = 0; c < 4; ++c) {
556  elt[r][c] = m[r][c];
557  }
558  }
559 }
double elt[4][4]
Definition: Matrix4.h:284
G3D::Matrix4float64::Matrix4float64 ( )

all zeros

562  {
563  for (int r = 0; r < 4; ++r) {
564  for (int c = 0; c < 4; ++c) {
565  elt[r][c] = 0.0;
566  }
567  }
568 }
double elt[4][4]
Definition: Matrix4.h:284

+ Here is the caller graph for this function:

G3D::Matrix4float64::Matrix4float64 ( double  r1c1,
double  r1c2,
double  r1c3,
double  r1c4,
double  r2c1,
double  r2c2,
double  r2c3,
double  r2c4,
double  r3c1,
double  r3c2,
double  r3c3,
double  r3c4,
double  r4c1,
double  r4c2,
double  r4c3,
double  r4c4 
)
575  {
576  elt[0][0] = r1c1; elt[0][1] = r1c2; elt[0][2] = r1c3; elt[0][3] = r1c4;
577  elt[1][0] = r2c1; elt[1][1] = r2c2; elt[1][2] = r2c3; elt[1][3] = r2c4;
578  elt[2][0] = r3c1; elt[2][1] = r3c2; elt[2][2] = r3c3; elt[2][3] = r3c4;
579  elt[3][0] = r4c1; elt[3][1] = r4c2; elt[3][2] = r4c3; elt[3][3] = r4c4;
580 }
double elt[4][4]
Definition: Matrix4.h:284

Member Function Documentation

const Matrix4float64 & G3D::Matrix4float64::identity ( )
static
583  {
584  static Matrix4float64 m(
585  1, 0, 0, 0,
586  0, 1, 0, 0,
587  0, 0, 1, 0,
588  0, 0, 0, 1);
589  return m;
590 }
Matrix4float64()
Definition: Matrix4.cpp:562
G3D::Matrix4float64::operator const double * ( ) const
inline
336  {
337  return (const double*)&elt[0][0];
338  }
double elt[4][4]
Definition: Matrix4.h:284
G3D::Matrix4float64::operator double * ( )
inline
332  {
333  return (double*)&elt[0][0];
334  }
double elt[4][4]
Definition: Matrix4.h:284
bool G3D::Matrix4float64::operator!= ( const Matrix4float64 other) const
599  {
600  return ! (*this == other);
601 }
Vector4 G3D::Matrix4float64::operator* ( const Vector4 vector) const
625  {
626  Vector4 result;
627  for (int r = 0; r < 4; ++r) {
628  double sum = 0;
629  for (int c = 0; c < 4; ++c) {
630  sum += elt[r][c] * vector[c];
631  }
632  result[r] = (float)sum;
633  }
634 
635  return result;
636 }
double elt[4][4]
Definition: Matrix4.h:284
bool G3D::Matrix4float64::operator== ( const Matrix4float64 other) const
604  {
605 
606  // If the bit patterns are identical, they must be
607  // the same matrix. If not, they *might* still have
608  // equal elements due to floating point weirdness.
609  if (memcmp(this, &other, sizeof(Matrix4float64)) == 0) {
610  return true;
611  }
612 
613  for (int r = 0; r < 4; ++r) {
614  for (int c = 0; c < 4; ++c) {
615  if (elt[r][c] != other.elt[r][c]) {
616  return false;
617  }
618  }
619  }
620 
621  return true;
622 }
Matrix4float64()
Definition: Matrix4.cpp:562
double elt[4][4]
Definition: Matrix4.h:284
double* G3D::Matrix4float64::operator[] ( int  r)
inline
320  {
321  debugAssert(r >= 0);
322  debugAssert(r < 4);
323  return (double*)&elt[r];
324  }
#define debugAssert(exp)
Definition: debugAssert.h:160
double elt[4][4]
Definition: Matrix4.h:284
const double* G3D::Matrix4float64::operator[] ( int  r) const
inline
326  {
327  debugAssert(r >= 0);
328  debugAssert(r < 4);
329  return (const double*)&elt[r];
330  }
#define debugAssert(exp)
Definition: debugAssert.h:160
double elt[4][4]
Definition: Matrix4.h:284
Matrix4float64 G3D::Matrix4float64::perspectiveProjection ( double  left,
double  right,
double  bottom,
double  top,
double  nearval,
double  farval,
float  upDirection = -1.0f 
)
static
646  {
647  double x, y, a, b, c, d;
648 
649  x = (2.0*nearval) / (right-left);
650  y = (2.0*nearval) / (top-bottom);
651  a = (right+left) / (right-left);
652  b = (top+bottom) / (top-bottom);
653 
654  if (farval >= inf()) {
655  // Infinite view frustum
656  c = -1.0;
657  d = -2.0 * nearval;
658  } else {
659  c = -(farval+nearval) / (farval-nearval);
660  d = -(2.0*farval*nearval) / (farval-nearval);
661  }
662 
663  debugAssertM(abs(upDirection) == 1.0, "upDirection must be -1 or +1");
664  y *= upDirection;
665  b *= upDirection;
666 
667  return Matrix4float64(
668  (float)x, 0, (float)a, 0,
669  0, (float)y, (float)b, 0,
670  0, 0, (float)c, (float)d,
671  0, 0, -1, 0);
672 }
double abs(double fValue)
Definition: g3dmath.h:617
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
double inf()
Definition: g3dmath.cpp:40
G3D::int16 y
Definition: Vector2int16.h:38
bool left(const int *a, const int *b, const int *c)
Definition: RecastContour.cpp:487
Matrix4float64()
Definition: Matrix4.cpp:562
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

const Matrix4float64 & G3D::Matrix4float64::zero ( )
static
593  {
594  static Matrix4float64 m;
595  return m;
596 }
Matrix4float64()
Definition: Matrix4.cpp:562

Member Data Documentation

double G3D::Matrix4float64::elt[4][4]
private

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