SbMatrix.h Source File

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

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SbMatrix.h
1 #ifndef COIN_SBMATRIX_H
2 #define COIN_SBMATRIX_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 SbLine;
31 class SbRotation;
32 class SbVec3f;
33 class SbVec4f;
34
35 typedef float SbMat[4][4];
36
37 class COIN_DLL_API SbMatrix {
38 public:
39 SbMatrix(void);
40 SbMatrix(const float a11, const float a12, const float a13, const float a14,
41 const float a21, const float a22, const float a23, const float a24,
42 const float a31, const float a32, const float a33, const float a34,
43 const float a41, const float a42, const float a43, const float a44);
44 SbMatrix(const SbMat & matrix);
45 SbMatrix(const SbMat * matrix);
46 ~SbMatrix(void);
47
48 SbMatrix & operator =(const SbMat & m);
49
50 operator float*(void);
51 SbMatrix & operator =(const SbMatrix & m);
52 void setValue(const SbMat & m);
53 void setValue(const class SbDPMatrix & m);
54 const SbMat & getValue(void) const;
55
56 void makeIdentity(void);
57 void setRotate(const SbRotation & q);
58 SbMatrix inverse(void) const;
59 float det3(int r1, int r2, int r3,
60 int c1, int c2, int c3) const;
61 float det3(void) const;
62 float det4(void) const;
63
64 SbBool equals(const SbMatrix & m, float tolerance) const;
65
66
67 operator SbMat&(void);
68 float * operator [](int i);
69 const float * operator [](int i) const;
70 SbMatrix & operator =(const SbRotation & q);
71 SbMatrix & operator *=(const SbMatrix & m);
72 friend COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2);
73 friend COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2);
74 friend COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2);
75 void getValue(SbMat & m) const;
76 static SbMatrix identity(void);
77 void setScale(const float s);
78 void setScale(const SbVec3f & s);
79 void setTranslate(const SbVec3f & t);
80 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s);
81 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s,
82 const SbRotation & so);
83 void setTransform(const SbVec3f & translation,
84 const SbRotation & rotation, const SbVec3f & scaleFactor,
85 const SbRotation & scaleOrientation, const SbVec3f & center);
86 void getTransform(SbVec3f & t, SbRotation & r,
87 SbVec3f & s, SbRotation & so) const;
88 void getTransform(SbVec3f & translation, SbRotation & rotation,
89 SbVec3f & scaleFactor, SbRotation & scaleOrientation,
90 const SbVec3f & center) const;
91 SbBool factor(SbMatrix & r, SbVec3f & s, SbMatrix & u, SbVec3f & t,
92 SbMatrix & proj);
93 SbBool LUDecomposition(int index[4], float & d);
94 void LUBackSubstitution(int index[4], float b[4]) const;
95 SbMatrix transpose(void) const;
96 SbMatrix & multRight(const SbMatrix & m);
97 SbMatrix & multLeft(const SbMatrix & m);
98 void multMatrixVec(const SbVec3f & src, SbVec3f & dst) const;
99 void multVecMatrix(const SbVec3f & src, SbVec3f & dst) const;
100 void multDirMatrix(const SbVec3f & src, SbVec3f & dst) const;
101 void multLineMatrix(const SbLine & src, SbLine & dst) const;
102 void multVecMatrix(const SbVec4f & src, SbVec4f & dst) const;
103
104 void print(FILE * fp) const;
105
106 private:
107 float matrix[4][4];
108
109 void operator /=(const float v);
110 void operator *=(const float v);
111 };
112
113 COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2);
114 COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2);
115 COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2);
116
117 #endif // !COIN_SBMATRIX_H
SbVec4f
The SbVec4f class is a 4 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec4f.h:40
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
SbRotation
The SbRotation class represents a rotation in 3D space.SbRotation is used extensively throughout the ...
Definition: SbRotation.h:33
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SbVec2d::operator*
SbVec2d operator*(const SbVec2d &v, double d)
Definition: SbVec2d.h:82
SbLine
The SbLine class represents a line in 3D space.SbLine provides a way of specifying a directed line...
Definition: SbLine.h:32
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.SbMatrix is used by many other cla...
Definition: SbMatrix.h:37
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.