Go to the documentation of this file.
34 class LX_BASE_EXPORT Matrix4D
36 typedef float_traits<double> traits_type;
46 Matrix4D (
float a11,
float a12,
float a13,
float a14,
47 float a21,
float a22,
float a23,
float a24,
48 float a31,
float a32,
float a33,
float a34,
49 float a41,
float a42,
float a43,
float a44 );
51 Matrix4D (
double a11,
double a12,
double a13,
double a14,
52 double a21,
double a22,
double a23,
double a24,
53 double a31,
double a32,
double a33,
double a34,
54 double a41,
double a42,
double a43,
double a44 );
85 inline bool operator == (
const Matrix4D& rclMtrx)
const;
87 inline double* operator [] (
unsigned short usNdx);
89 inline const double* operator[] (
unsigned short usNdx)
const;
91 double determinant()
const;
93 std::string analyse(
void)
const;
102 void getMatrix (
double dMtrx[16])
const;
103 void setMatrix (
const double dMtrx[16]);
105 void getGLMatrix (
double dMtrx[16])
const;
107 void setGLMatrix (
const double dMtrx[16]);
109 unsigned long getMemSpace (
void);
113 void setToUnity(
void);
118 void move (
float x,
float y,
float z)
120 void move (
double x,
double y,
double z)
126 void scale (
float x,
float y,
float z)
128 void scale (
double x,
double y,
double z)
132 void scale (
const Vector3d& rclVct);
134 int hasScale(
double tol=0.0)
const;
136 void rotX (
double fAngle);
138 void rotY (
double fAngle);
140 void rotZ (
double fAngle);
142 void rotLine (
const Vector3f& rclVct,
float fAngle);
144 void rotLine (
const Vector3d& rclVct,
double fAngle);
146 void rotLine (
const Vector3f& rclBase,
const Vector3f& rclDir,
float fAngle);
148 void rotLine (
const Vector3d& rclBase,
const Vector3d& rclDir,
double fAngle);
150 bool toAxisAngle (
Vector3f& rclBase,
Vector3f& rclDir,
float& fAngle,
float& fTranslation)
const;
151 bool toAxisAngle (
Vector3d& rclBase,
Vector3d& rclDir,
double& fAngle,
double& fTranslation)
const;
158 void inverseOrthogonal(
void);
160 void inverseGauss (
void);
161 void transpose (
void);
164 void Print (
void)
const;
166 std::string toString(
void)
const;
168 void fromString (
const std::string &str);
171 double dMtrx4D[4][4];
177 unsigned short iz, is;
179 for (iz = 0; iz < 4; iz++) {
180 for (is = 0; is < 4; is++) {
181 clMat.dMtrx4D[iz][is] = dMtrx4D[iz][is] + rclMtrx[iz][is];
190 unsigned short iz, is;
192 for (iz = 0; iz < 4; iz++) {
193 for (is = 0; is < 4; is++) {
194 dMtrx4D[iz][is] += rclMtrx[iz][is];
204 unsigned short iz, is;
206 for (iz = 0; iz < 4; iz++) {
207 for (is = 0; is < 4; is++) {
208 clMat.dMtrx4D[iz][is] = dMtrx4D[iz][is] - rclMtrx[iz][is];
217 unsigned short iz, is;
219 for (iz = 0; iz < 4; iz++) {
220 for (is = 0; is < 4; is++) {
221 dMtrx4D[iz][is] -= rclMtrx[iz][is];
231 unsigned short ie, iz, is;
233 for (iz = 0; iz < 4; iz++)
234 for (is = 0; is < 4; is++) {
235 clMat.dMtrx4D[iz][is] = 0;
236 for (ie = 0; ie < 4; ie++)
237 clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] *
238 rclMtrx.dMtrx4D[ie][is];
249 unsigned short ie, iz, is;
251 for (iz = 0; iz < 4; iz++)
252 for (is = 0; is < 4; is++) {
253 clMat.dMtrx4D[iz][is] = 0;
254 for (ie = 0; ie < 4; ie++)
255 clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] *
256 rclMtrx.dMtrx4D[ie][is];
264 unsigned short iz, is;
266 for (iz = 0; iz < 4; iz++) {
267 for (is = 0; is < 4; is++) {
268 dMtrx4D[iz][is] = rclMtrx.dMtrx4D[iz][is];
277 double x =
static_cast<double>(rclVct.x);
278 double y =
static_cast<double>(rclVct.y);
279 double z =
static_cast<double>(rclVct.z);
281 static_cast<float>(dMtrx4D[0][0]*x + dMtrx4D[0][1]*y +
282 dMtrx4D[0][2]*z + dMtrx4D[0][3]),
283 static_cast<float>(dMtrx4D[1][0]*x + dMtrx4D[1][1]*y +
284 dMtrx4D[1][2]*z + dMtrx4D[1][3]),
285 static_cast<float>(dMtrx4D[2][0]*x + dMtrx4D[2][1]*y +
286 dMtrx4D[2][2]*z + dMtrx4D[2][3])
292 return Vector3d((dMtrx4D[0][0]*rclVct.
x + dMtrx4D[0][1]*rclVct.
y +
293 dMtrx4D[0][2]*rclVct.
z + dMtrx4D[0][3]),
294 (dMtrx4D[1][0]*rclVct.
x + dMtrx4D[1][1]*rclVct.
y +
295 dMtrx4D[1][2]*rclVct.
z + dMtrx4D[1][3]),
296 (dMtrx4D[2][0]*rclVct.
x + dMtrx4D[2][1]*rclVct.
y +
297 dMtrx4D[2][2]*rclVct.
z + dMtrx4D[2][3]));
302 double x = (dMtrx4D[0][0]*src.
x + dMtrx4D[0][1]*src.
y +
303 dMtrx4D[0][2]*src.
z + dMtrx4D[0][3]);
304 double y = (dMtrx4D[1][0]*src.
x + dMtrx4D[1][1]*src.
y +
305 dMtrx4D[1][2]*src.
z + dMtrx4D[1][3]);
306 double z = (dMtrx4D[2][0]*src.
x + dMtrx4D[2][1]*src.
y +
307 dMtrx4D[2][2]*src.
z + dMtrx4D[2][3]);
313 double sx =
static_cast<double>(src.
x);
314 double sy =
static_cast<double>(src.
y);
315 double sz =
static_cast<double>(src.
z);
317 double x = (dMtrx4D[0][0]*sx + dMtrx4D[0][1]*sy +
318 dMtrx4D[0][2]*sz + dMtrx4D[0][3]);
319 double y = (dMtrx4D[1][0]*sx + dMtrx4D[1][1]*sy +
320 dMtrx4D[1][2]*sz + dMtrx4D[1][3]);
321 double z = (dMtrx4D[2][0]*sx + dMtrx4D[2][1]*sy +
322 dMtrx4D[2][2]*sz + dMtrx4D[2][3]);
323 dst.
Set(
static_cast<float>(x),
324 static_cast<float>(y),
325 static_cast<float>(z));
330 unsigned short iz, is;
332 for (iz = 0; iz < 4; iz++) {
333 for (is = 0; is < 4; is++) {
344 return !( (*this) == rclMtrx );
350 rclVect = rclMtrx * rclVect;
356 return dMtrx4D[usNdx];
361 return dMtrx4D[usNdx];
bool operator==(const Matrix4D &rclMtrx) const
Comparison.
Definition: Matrix.h:348
_Precision y
Definition: Vector3D.h:86
void transform(Container container, OutputIt out, BinaryFunction function)
Definition: Algorithms.h:30
_Precision z
Definition: Vector3D.h:87
Matrix4D & operator-=(const Matrix4D &rclMtrx)
Definition: Matrix.h:235
double * operator[](unsigned short usNdx)
Index operator.
Definition: Matrix.h:374
Matrix4D & operator+=(const Matrix4D &rclMtrx)
Definition: Matrix.h:208
static float_type epsilon()
Definition: Vector3D.h:70
Vector3f & operator*=(Vector3f &rclVect, const Matrix4D &rclMtrx)
Definition: Matrix.h:367
_Precision x
Definition: Vector3D.h:85
Matrix4D operator+(const Matrix4D &rclMtrx) const
Matrix addition.
Definition: Matrix.h:194
Definition: Vector3D.h:77
bool operator!=(const Matrix4D &rclMtrx) const
Comparison.
Definition: Matrix.h:362
Vector3< double > Vector3d
Definition: Vector3D.h:246
Matrix4D & operator*=(const Matrix4D &rclMtrx)
Matrix multiplication.
Definition: Matrix.h:248
DualNumber operator*(DualNumber a, DualNumber b)
Definition: DualNumber.h:91
DualNumber operator-(DualNumber a, DualNumber b)
Definition: DualNumber.h:81
Matrix4D(void)
Default constructor.
constexpr bool operator!=(const basic_hashed_string< Char > &lhs, const basic_hashed_string< Char > &rhs) ENTT_NOEXCEPT
Compares two hashed strings.
Definition: entt.hpp:570
void Set(_Precision fX, _Precision fY, _Precision fZ)
Matrix4D & operator=(const Matrix4D &rclMtrx)
Assignment.
Definition: Matrix.h:282
Matrix4D operator-(const Matrix4D &rclMtrx) const
Matrix subtraction.
Definition: Matrix.h:221
DualNumber operator+(DualNumber a, DualNumber b)
Definition: DualNumber.h:71
Matrix4D operator*(const Matrix4D &rclMtrx) const
Matrix multiplication.
Definition: Matrix.h:266
void multVec(const Vector3d &src, Vector3d &dst) const
Definition: Matrix.h:320
Vector3< float > Vector3f
Definition: Vector3D.h:245
Definition: AbstractXMLReader.h:5