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) 1998-2007 by Systems in Motion. All rights reserved.
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 Systems in Motion about acquiring
18 * a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, 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 const SbMat & getValue(void) const;
54
55 void makeIdentity(void);
56 void setRotate(const SbRotation & q);
57 SbMatrix inverse(void) const;
58 float det3(int r1, int r2, int r3,
59 int c1, int c2, int c3) const;
60 float det3(void) const;
61 float det4(void) const;
62
63 SbBool equals(const SbMatrix & m, float tolerance) const;
64
65
66 operator SbMat&(void);
67 float * operator [](int i);
68 const float * operator [](int i) const;
69 SbMatrix & operator =(const SbRotation & q);
70 SbMatrix & operator *=(const SbMatrix & m);
71 friend COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2);
72 friend COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2);
73 friend COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2);
74 void getValue(SbMat & m) const;
75 static SbMatrix identity(void);
76 void setScale(const float s);
77 void setScale(const SbVec3f & s);
78 void setTranslate(const SbVec3f & t);
79 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s);
80 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s,
81 const SbRotation & so);
82 void setTransform(const SbVec3f & translation,
83 const SbRotation & rotation, const SbVec3f & scaleFactor,
84 const SbRotation & scaleOrientation, const SbVec3f & center);
85 void getTransform(SbVec3f & t, SbRotation & r,
86 SbVec3f & s, SbRotation & so) const;
87 void getTransform(SbVec3f & translation, SbRotation & rotation,
88 SbVec3f & scaleFactor, SbRotation & scaleOrientation,
89 const SbVec3f & center) const;
90 SbBool factor(SbMatrix & r, SbVec3f & s, SbMatrix & u, SbVec3f & t,
91 SbMatrix & proj);
92 SbBool LUDecomposition(int index[4], float & d);
93 void LUBackSubstitution(int index[4], float b[4]) const;
94 SbMatrix transpose(void) const;
95 SbMatrix & multRight(const SbMatrix & m);
96 SbMatrix & multLeft(const SbMatrix & m);
97 void multMatrixVec(const SbVec3f & src, SbVec3f & dst) const;
98 void multVecMatrix(const SbVec3f & src, SbVec3f & dst) const;
99 void multDirMatrix(const SbVec3f & src, SbVec3f & dst) const;
100 void multLineMatrix(const SbLine & src, SbLine & dst) const;
101 void multVecMatrix(const SbVec4f & src, SbVec4f & dst) const;
102
103 void print(FILE * fp) const;
104
105private:
106 float matrix[4][4];
107
108 void operator /=(const float v);
109 void operator *=(const float v);
110};
111
112COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2);
113COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2);
114COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2);
115
116#endif // !COIN_SBMATRIX_H
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
const SbMat & getValue(void) const
Definition SbMatrix.cpp:255
SbBool equals(const SbMatrix &m, float tolerance) const
Definition SbMatrix.cpp:589
void LUBackSubstitution(int index[4], float b[4]) const
Definition SbMatrix.cpp:1172
SbMatrix transpose(void) const
Definition SbMatrix.cpp:1216
void multLineMatrix(const SbLine &src, SbLine &dst) const
Definition SbMatrix.cpp:1435
SbMatrix inverse(void) const
Definition SbMatrix.cpp:418
SbBool LUDecomposition(int index[4], float &d)
Definition SbMatrix.cpp:1110
void getTransform(SbVec3f &t, SbRotation &r, SbVec3f &s, SbRotation &so) const
Definition SbMatrix.cpp:997
void print(FILE *fp) const
Definition SbMatrix.cpp:1448
void setValue(const SbMat &m)
Definition SbMatrix.cpp:266
void multDirMatrix(const SbVec3f &src, SbVec3f &dst) const
Definition SbMatrix.cpp:1411
SbMatrix & multRight(const SbMatrix &m)
Definition SbMatrix.cpp:1240
void setTranslate(const SbVec3f &t)
Definition SbMatrix.cpp:790
SbMatrix & multLeft(const SbMatrix &m)
Definition SbMatrix.cpp:1280
void makeIdentity(void)
Definition SbMatrix.cpp:297
SbMatrix(void)
Definition SbMatrix.cpp:200
float det3(int r1, int r2, int r3, int c1, int c2, int c3) const
Definition SbMatrix.cpp:352
void setTransform(const SbVec3f &t, const SbRotation &r, const SbVec3f &s)
Definition SbMatrix.cpp:812
void setScale(const float s)
Definition SbMatrix.cpp:760
void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
Definition SbMatrix.cpp:1357
float det4(void) const
Definition SbMatrix.cpp:400
void setRotate(const SbRotation &q)
Definition SbMatrix.cpp:314
static SbMatrix identity(void)
Definition SbMatrix.cpp:748
void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const
Definition SbMatrix.cpp:1319
SbBool factor(SbMatrix &r, SbVec3f &s, SbMatrix &u, SbVec3f &t, SbMatrix &proj)
Definition SbMatrix.cpp:1077
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:37
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition SbVec4f.h:34

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Wed Jul 23 2025 for Coin by Doxygen. 1.14.0