| http://www.sim.no/ http://www.coin3d.org/

SbDPMatrix.h
1 #ifndef COIN_SBDPMATRIX_H
2 #define COIN_SBDPMATRIX_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <stdio.h>
28 #include <Inventor/SbBasic.h>
29
30 class SbDPLine;
31 class SbDPRotation;
32 class SbVec3d;
33 class SbVec4d;
34 class SbMatrix;
35
36 typedef double SbDPMat[4][4];
37
38 class COIN_DLL_API SbDPMatrix {
39 public:
40 SbDPMatrix(void);
41 SbDPMatrix(const double a11, const double a12, const double a13, const double a14,
42 const double a21, const double a22, const double a23, const double a24,
43 const double a31, const double a32, const double a33, const double a34,
44 const double a41, const double a42, const double a43, const double a44);
45 SbDPMatrix(const SbDPMat & matrix);
46 SbDPMatrix(const SbDPMat * matrix);
47 SbDPMatrix(const SbMatrix & matrix);
48 ~SbDPMatrix(void);
49
50 SbDPMatrix & operator =(const SbDPMat & m);
51
52 operator double*(void);
53 SbDPMatrix & operator =(const SbDPMatrix & m);
54 void setValue(const SbDPMat & m);
55 const SbDPMat & getValue(void) const;
56
57 void makeIdentity(void);
58 void setRotate(const SbDPRotation & q);
59 SbDPMatrix inverse(void) const;
60 double det3(int r1, int r2, int r3,
61 int c1, int c2, int c3) const;
62 double det3(void) const;
63 double det4(void) const;
64
65 SbBool equals(const SbDPMatrix & m, double tolerance) const;
66
67
68 operator SbDPMat&(void);
69 double * operator [](int i);
70 const double * operator [](int i) const;
71 SbDPMatrix & operator =(const SbDPRotation & q);
72 SbDPMatrix & operator *=(const SbDPMatrix & m);
73 friend COIN_DLL_API SbDPMatrix operator *(const SbDPMatrix & m1, const SbDPMatrix & m2);
74 friend COIN_DLL_API int operator ==(const SbDPMatrix & m1, const SbDPMatrix & m2);
75 friend COIN_DLL_API int operator !=(const SbDPMatrix & m1, const SbDPMatrix & m2);
76 void getValue(SbDPMat & m) const;
77 static SbDPMatrix identity(void);
78 void setScale(const double s);
79 void setScale(const SbVec3d & s);
80 void setTranslate(const SbVec3d & t);
81 void setTransform(const SbVec3d & t, const SbDPRotation & r, const SbVec3d & s);
82 void setTransform(const SbVec3d & t, const SbDPRotation & r, const SbVec3d & s,
83 const SbDPRotation & so);
84 void setTransform(const SbVec3d & translation,
85 const SbDPRotation & rotation, const SbVec3d & scaleFactor,
86 const SbDPRotation & scaleOrientation, const SbVec3d & center);
87 void getTransform(SbVec3d & t, SbDPRotation & r,
88 SbVec3d & s, SbDPRotation & so) const;
89 void getTransform(SbVec3d & translation, SbDPRotation & rotation,
90 SbVec3d & scaleFactor, SbDPRotation & scaleOrientation,
91 const SbVec3d & center) const;
92 SbBool factor(SbDPMatrix & r, SbVec3d & s, SbDPMatrix & u, SbVec3d & t,
93 SbDPMatrix & proj);
94 SbBool LUDecomposition(int index[4], double & d);
95 void LUBackSubstitution(int index[4], double b[4]) const;
96 SbDPMatrix transpose(void) const;
97 SbDPMatrix & multRight(const SbDPMatrix & m);
98 SbDPMatrix & multLeft(const SbDPMatrix & m);
99 void multMatrixVec(const SbVec3d & src, SbVec3d & dst) const;
100 void multVecMatrix(const SbVec3d & src, SbVec3d & dst) const;
101 void multDirMatrix(const SbVec3d & src, SbVec3d & dst) const;
102 void multLineMatrix(const SbDPLine & src, SbDPLine & dst) const;
103 void multVecMatrix(const SbVec4d & src, SbVec4d & dst) const;
104
105 void print(FILE * fp) const;
106
107 private:
108 double matrix[4][4];
109
110 void operator /=(const double v);
111 void operator *=(const double v);
112 };
113
114 COIN_DLL_API SbDPMatrix operator *(const SbDPMatrix & m1, const SbDPMatrix & m2);
115 COIN_DLL_API int operator ==(const SbDPMatrix & m1, const SbDPMatrix & m2);
116 COIN_DLL_API int operator !=(const SbDPMatrix & m1, const SbDPMatrix & m2);
117
118 #endif // !COIN_SBDPMATRIX_H
SbDPLine
The SbDPLine class represents a line in 3D space.SbDPLine is used by many other classes in Coin...
Definition: SbDPLine.h:32
SbVec3d
The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.This vector class provides storage for a 3 dimensional double precision floating point vector aswell as simple floating point arithmetic operations.
Definition: SbVec3d.h:39
SbBox2d::operator!=
int operator!=(const SbBox2d &b1, const SbBox2d &b2)
Definition: SbBox2d.h:92
SbBox2d::operator==
int operator==(const SbBox2d &b1, const SbBox2d &b2)
Definition: SbBox2d.h:88
SbVec2d::operator*
SbVec2d operator*(const SbVec2d &v, double d)
Definition: SbVec2d.h:82
SbDPRotation
The SbDPRotation class represents a rotation in 3D space.SbDPRotation is used extensively throughout ...
Definition: SbDPRotation.h:33
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.SbMatrix is used by many other cla...
Definition: SbMatrix.h:37
SbVec4d
The SbVec4d class is a 4 dimensional vector with double precision floating point coordinates.This vector class is not by many other classes in Coin. It provides storage for a 3 dimensional homogeneoues vector (with the 4 components usually referred to as <x, y, z, w>) aswell as simple double precision floating point arithmetic operations.
Definition: SbVec4d.h:40
SbDPMatrix
The SbDPMatrix class is a 4x4 dimensional representation of a double-precision matrix.This class is like the SbMatrix class, but uses double-precision floating point values for its elements. For more class documentation, see SbMatrix.
Definition: SbDPMatrix.h:38

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.