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,2024 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  explicit FXMat3d(FXdouble s);
43 
45  FXMat3d(FXdouble a00,FXdouble a01,FXdouble a02,
46  FXdouble a10,FXdouble a11,FXdouble a12,
47  FXdouble a20,FXdouble a21,FXdouble a22);
48 
50  FXMat3d(const FXMat2d& s);
51 
53  FXMat3d(const FXMat3d& s);
54 
56  FXMat3d(const FXMat4d& s);
57 
59  FXMat3d(const FXQuatd& quat);
60 
62  FXMat3d(const FXVec3d& a,const FXVec3d& b,const FXVec3d& c);
63 
65  FXMat3d(FXdouble a,FXdouble b,FXdouble c);
66 
68  explicit FXMat3d(const FXVec3d& d);
69 
71  explicit FXMat3d(const FXdouble s[]);
72 
74  FXMat3d& operator=(FXdouble s);
75 
77  FXMat3d& operator=(const FXMat2d& s);
78  FXMat3d& operator=(const FXMat3d& s);
79  FXMat3d& operator=(const FXMat4d& s);
80 
82  FXMat3d& operator=(const FXQuatd& quat);
83 
85  FXMat3d& operator=(const FXdouble s[]);
86 
88  FXMat3d& set(FXdouble s);
89 
91  FXMat3d& set(FXdouble a00,FXdouble a01,FXdouble a02,
92  FXdouble a10,FXdouble a11,FXdouble a12,
93  FXdouble a20,FXdouble a21,FXdouble a22);
94 
96  FXMat3d& set(const FXMat2d& s);
97 
99  FXMat3d& set(const FXMat3d& s);
100 
102  FXMat3d& set(const FXMat4d& s);
103 
105  FXMat3d& set(const FXQuatd& quat);
106 
108  FXMat3d& set(const FXVec3d& a,const FXVec3d& b,const FXVec3d& c);
109 
111  FXMat3d& set(FXdouble a,FXdouble b,FXdouble c);
112 
114  FXMat3d& set(const FXVec3d& d);
115 
117  FXMat3d& set(const FXdouble s[]);
118 
120  FXMat3d& operator+=(const FXMat3d& w);
121  FXMat3d& operator-=(const FXMat3d& w);
122  FXMat3d& operator*=(const FXMat3d& w);
123  FXMat3d& operator*=(FXdouble w);
124  FXMat3d& operator/=(FXdouble w);
125 
127  FXVec3d& operator[](FXint i){return m[i];}
128  const FXVec3d& operator[](FXint i) const {return m[i];}
129 
131  operator FXdouble*(){return m[0];}
132  operator const FXdouble*() const {return m[0];}
133 
135  FXMat3d operator-() const;
136 
138  FXMat3d& identity();
139 
141  FXbool isIdentity() const;
142 
144  FXMat3d& rot(const FXQuatd& q);
145 
147  FXMat3d& rot(const FXVec3d& v,FXdouble c,FXdouble s);
148 
150  FXMat3d& rot(const FXVec3d& v,FXdouble phi);
151 
153  FXMat3d& xrot(FXdouble c,FXdouble s);
154  FXMat3d& xrot(FXdouble phi);
155 
157  FXMat3d& yrot(FXdouble c,FXdouble s);
158  FXMat3d& yrot(FXdouble phi);
159 
161  FXMat3d& zrot(FXdouble c,FXdouble s);
162  FXMat3d& zrot(FXdouble phi);
163 
165  FXMat3d& scale(FXdouble sx,FXdouble sy,FXdouble sz);
166  FXMat3d& scale(const FXVec3d& v);
167  FXMat3d& scale(FXdouble s);
168 
170  FXMat3d& mirror(const FXVec3d& n);
171 
173  FXdouble det() const;
174 
176  FXMat3d transpose() const;
177 
179  FXMat3d invert() const;
180 
183  };
184 
185 
187 extern FXAPI FXVec2d operator*(const FXMat3d& m,const FXVec2d& v);
188 extern FXAPI FXVec3d operator*(const FXMat3d& m,const FXVec3d& v);
189 
191 extern FXAPI FXVec2d operator*(const FXVec2d& v,const FXMat3d& m);
192 extern FXAPI FXVec3d operator*(const FXVec3d& v,const FXMat3d& m);
193 
195 extern FXAPI FXMat3d operator+(const FXMat3d& a,const FXMat3d& b);
196 extern FXAPI FXMat3d operator-(const FXMat3d& a,const FXMat3d& b);
197 
199 extern FXAPI FXMat3d operator*(const FXMat3d& a,const FXMat3d& b);
200 
202 extern FXAPI FXMat3d operator*(FXdouble x,const FXMat3d& a);
203 extern FXAPI FXMat3d operator*(const FXMat3d& a,FXdouble x);
204 extern FXAPI FXMat3d operator/(const FXMat3d& a,FXdouble x);
205 extern FXAPI FXMat3d operator/(FXdouble x,const FXMat3d& a);
206 
208 extern FXAPI FXbool operator==(const FXMat3d& a,const FXMat3d& b);
209 extern FXAPI FXbool operator!=(const FXMat3d& a,const FXMat3d& b);
210 extern FXAPI FXbool operator==(const FXMat3d& a,FXdouble n);
211 extern FXAPI FXbool operator!=(const FXMat3d& a,FXdouble n);
212 extern FXAPI FXbool operator==(FXdouble n,const FXMat3d& a);
213 extern FXAPI FXbool operator!=(FXdouble n,const FXMat3d& a);
214 
216 extern FXAPI FXMat3d orthogonalize(const FXMat3d& m);
217 
219 extern FXAPI FXStream& operator<<(FXStream& store,const FXMat3d& m);
220 
222 extern FXAPI FXStream& operator>>(FXStream& store,FXMat3d& m);
223 
224 }
225 
226 #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:182
FXVec3d & operator[](FXint i)
Indexing.
Definition: FXMat3d.h:127
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