Coin  4.0.10
Coin3D core library
Loading...
Searching...
No Matches
SbDPMatrix.h
1#ifndef COIN_SBDPMATRIX_H
2#define COIN_SBDPMATRIX_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <cstdio>
37#include <Inventor/SbBasic.h>
38
39class SbDPLine;
40class SbDPRotation;
41class SbVec3d;
42class SbVec4d;
43class SbMatrix;
44
45typedef double SbDPMat[4][4];
46
48public:
49 SbDPMatrix(void);
50 SbDPMatrix(const double a11, const double a12, const double a13, const double a14,
51 const double a21, const double a22, const double a23, const double a24,
52 const double a31, const double a32, const double a33, const double a34,
53 const double a41, const double a42, const double a43, const double a44);
54 SbDPMatrix(const SbDPMat & matrix);
55 SbDPMatrix(const SbDPMat * matrix);
56 SbDPMatrix(const SbMatrix & matrix);
57 SbDPMatrix(const SbDPMatrix & matrix) = default;
58 ~SbDPMatrix(void);
59
60 void setValue(const SbDPMat & m);
61 void setValue(const SbMatrix & m);
62 void setValue(const double * pMat);
63 const SbDPMat & getValue(void) const;
64
65 void makeIdentity(void);
66 void setRotate(const SbDPRotation & q);
67 SbDPMatrix inverse(void) const;
68 double det3(int r1, int r2, int r3,
69 int c1, int c2, int c3) const;
70 double det3(void) const;
71 double det4(void) const;
72
73 SbBool equals(const SbDPMatrix & m, double tolerance) const;
74
75
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,
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 operator double*(void);
108 operator SbDPMat&(void);
109 double * operator [](int i);
110 const double * operator [](int i) const;
111
112 SbDPMatrix & operator =(const SbDPMat & m);
116
118 friend COIN_DLL_API int operator ==(const SbDPMatrix & m1, const SbDPMatrix & m2);
119 friend COIN_DLL_API int operator !=(const SbDPMatrix & m1, const SbDPMatrix & m2);
120private:
121 double matrix[4][4];
122
123 void operator /=(const double v);
124 void operator *=(const double v);
125};
126
127typedef SbDPMatrix SbMatrixd;
128
130COIN_DLL_API int operator ==(const SbDPMatrix & m1, const SbDPMatrix & m2);
131COIN_DLL_API int operator !=(const SbDPMatrix & m1, const SbDPMatrix & m2);
132
133#endif // !COIN_SBDPMATRIX_H
The SbDPLine class represents a line using double precision coordinates.
Definition SbDPLine.h:41
The SbDPMatrix class is a 4x4 dimensional representation of a double-precision matrix.
Definition SbDPMatrix.h:47
The SbDPRotation class represents a rotation in 3D space using double precision data.
Definition SbDPRotation.h:42
The SbList class is a template container class for lists.
Definition SbList.h:72
SbList< Type > & operator=(const SbList< Type > &l)
Definition SbList.h:101
int operator!=(const SbList< Type > &l) const
Definition SbList.h:225
SbList(const int sizehint=DEFAULTSIZE)
Definition SbList.h:80
int operator==(const SbList< Type > &l) const
Definition SbList.h:217
Type operator[](const int index) const
Definition SbList.h:203
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.
Definition SbVec3d.h:50
The SbVec4d class is a 4 dimensional vector with double precision floating point coordinates.
Definition SbVec4d.h:49