Coin Logo 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
30class SbDPLine;
31class SbDPRotation;
32class SbVec3d;
33class SbVec4d;
34class SbMatrix;
35
36typedef double SbDPMat[4][4];
37
38class COIN_DLL_API SbDPMatrix {
39public:
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
107private:
108 double matrix[4][4];
109
110 void operator /=(const double v);
111 void operator *=(const double v);
112};
113
114COIN_DLL_API SbDPMatrix operator *(const SbDPMatrix & m1, const SbDPMatrix & m2);
115COIN_DLL_API int operator ==(const SbDPMatrix & m1, const SbDPMatrix & m2);
116COIN_DLL_API int operator !=(const SbDPMatrix & m1, const SbDPMatrix & m2);
117
118#endif // !COIN_SBDPMATRIX_H
The SbDPLine class represents a line in 3D space.
Definition SbDPLine.h:32
The SbDPMatrix class is a 4x4 dimensional representation of a double-precision matrix.
Definition SbDPMatrix.h:38
The SbDPRotation class represents a rotation in 3D space.
Definition SbDPRotation.h:33
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:37
The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.
Definition SbVec3d.h:39
The SbVec4d class is a 4 dimensional vector with double precision floating point coordinates.
Definition SbVec4d.h:40

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

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.