Coin Logo http://www.sim.no/
http://www.coin3d.org/

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