Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXMat3d.h
1 /********************************************************************************
2 * *
3 * D o u b l e - P r e c i s i o n 3 x 3 M a t r i x *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2003,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXMAT3D_H
22 #define FXMAT3D_H
23 
24 namespace FX {
25 
26 
27 class FXQuatd;
28 class FXMat2d;
29 class FXMat4d;
30 
31 
33 class FXAPI FXMat3d {
34 protected:
35  FXVec3d m[3];
36 public:
37 
39  FXMat3d(){}
40 
42  FXMat3d(FXdouble s);
43 
45  FXMat3d(const FXMat2d& s);
46 
48  FXMat3d(const FXMat3d& s);
49 
51  FXMat3d(const FXMat4d& s);
52 
54  FXMat3d(const FXdouble s[]);
55 
57  FXMat3d(FXdouble a,FXdouble b,FXdouble c);
58 
60  FXMat3d(FXdouble a00,FXdouble a01,FXdouble a02,
61  FXdouble a10,FXdouble a11,FXdouble a12,
62  FXdouble a20,FXdouble a21,FXdouble a22);
63 
65  FXMat3d(const FXVec3d& a,const FXVec3d& b,const FXVec3d& c);
66 
68  FXMat3d(const FXQuatd& quat);
69 
71  FXMat3d& operator=(FXdouble s);
72 
74  FXMat3d& operator=(const FXMat2d& s);
75  FXMat3d& operator=(const FXMat3d& s);
76  FXMat3d& operator=(const FXMat4d& s);
77 
79  FXMat3d& operator=(const FXQuatd& quat);
80 
82  FXMat3d& operator=(const FXdouble s[]);
83 
85  FXMat3d& set(FXdouble s);
86 
88  FXMat3d& set(const FXMat2d& s);
89 
91  FXMat3d& set(const FXMat3d& s);
92 
94  FXMat3d& set(const FXMat4d& s);
95 
97  FXMat3d& set(const FXdouble s[]);
98 
100  FXMat3d& set(FXdouble a,FXdouble b,FXdouble c);
101 
103  FXMat3d& set(FXdouble a00,FXdouble a01,FXdouble a02,
104  FXdouble a10,FXdouble a11,FXdouble a12,
105  FXdouble a20,FXdouble a21,FXdouble a22);
106 
108  FXMat3d& set(const FXVec3d& a,const FXVec3d& b,const FXVec3d& c);
109 
111  FXMat3d& set(const FXQuatd& quat);
112 
114  FXMat3d& operator+=(const FXMat3d& w);
115  FXMat3d& operator-=(const FXMat3d& w);
116  FXMat3d& operator*=(const FXMat3d& w);
117  FXMat3d& operator*=(FXdouble w);
118  FXMat3d& operator/=(FXdouble w);
119 
121  FXVec3d& operator[](FXint i){return m[i];}
122  const FXVec3d& operator[](FXint i) const {return m[i];}
123 
125  operator FXdouble*(){return m[0];}
126  operator const FXdouble*() const {return m[0];}
127 
129  FXMat3d operator-() const;
130 
132  FXMat3d& identity();
133 
135  FXbool isIdentity() const;
136 
138  FXMat3d& rot(const FXQuatd& q);
139 
141  FXMat3d& rot(const FXVec3d& v,FXdouble c,FXdouble s);
142 
144  FXMat3d& rot(const FXVec3d& v,FXdouble phi);
145 
147  FXMat3d& xrot(FXdouble c,FXdouble s);
148  FXMat3d& xrot(FXdouble phi);
149 
151  FXMat3d& yrot(FXdouble c,FXdouble s);
152  FXMat3d& yrot(FXdouble phi);
153 
155  FXMat3d& zrot(FXdouble c,FXdouble s);
156  FXMat3d& zrot(FXdouble phi);
157 
159  FXMat3d& scale(FXdouble sx,FXdouble sy,FXdouble sz);
160  FXMat3d& scale(const FXVec3d& v);
161  FXMat3d& scale(FXdouble s);
162 
164  FXdouble det() const;
165 
167  FXMat3d transpose() const;
168 
170  FXMat3d invert() const;
171 
174  };
175 
176 
178 extern FXAPI FXVec2d operator*(const FXMat3d& m,const FXVec2d& v);
179 extern FXAPI FXVec3d operator*(const FXMat3d& m,const FXVec3d& v);
180 
182 extern FXAPI FXVec2d operator*(const FXVec2d& v,const FXMat3d& m);
183 extern FXAPI FXVec3d operator*(const FXVec3d& v,const FXMat3d& m);
184 
186 extern FXAPI FXMat3d operator+(const FXMat3d& a,const FXMat3d& b);
187 extern FXAPI FXMat3d operator-(const FXMat3d& a,const FXMat3d& b);
188 
190 extern FXAPI FXMat3d operator*(const FXMat3d& a,const FXMat3d& b);
191 
193 extern FXAPI FXMat3d operator*(FXdouble x,const FXMat3d& a);
194 extern FXAPI FXMat3d operator*(const FXMat3d& a,FXdouble x);
195 extern FXAPI FXMat3d operator/(const FXMat3d& a,FXdouble x);
196 extern FXAPI FXMat3d operator/(FXdouble x,const FXMat3d& a);
197 
199 extern FXAPI FXbool operator==(const FXMat3d& a,const FXMat3d& b);
200 extern FXAPI FXbool operator!=(const FXMat3d& a,const FXMat3d& b);
201 extern FXAPI FXbool operator==(const FXMat3d& a,FXdouble n);
202 extern FXAPI FXbool operator!=(const FXMat3d& a,FXdouble n);
203 extern FXAPI FXbool operator==(FXdouble n,const FXMat3d& a);
204 extern FXAPI FXbool operator!=(FXdouble n,const FXMat3d& a);
205 
207 extern FXAPI FXMat3d orthogonalize(const FXMat3d& m);
208 
210 extern FXAPI FXStream& operator<<(FXStream& store,const FXMat3d& m);
211 
213 extern FXAPI FXStream& operator>>(FXStream& store,FXMat3d& m);
214 
215 }
216 
217 #endif
Double-precision quaternion.
Definition: FXQuatd.h:32
Double-precision 3-element vector.
Definition: FXVec3d.h:28
Double-precision 4x4 matrix.
Definition: FXMat4d.h:32
Double-precision 2x2 matrix.
Definition: FXMat2d.h:31
~FXMat3d()
Destructor.
Definition: FXMat3d.h:173
FXVec3d & operator[](FXint i)
Indexing.
Definition: FXMat3d.h:121
Definition: FX4Splitter.h:28
FXMat3d()
Default constructor; value is not initialized.
Definition: FXMat3d.h:39
Double-precision 3x3 matrix.
Definition: FXMat3d.h:33

Copyright © 1997-2022 Jeroen van der Zijp