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

FXMat3f.h
1 /********************************************************************************
2 * *
3 * S i n g 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 FXMAT3F_H
22 #define FXMAT3F_H
23 
24 namespace FX {
25 
26 
27 class FXQuatf;
28 class FXMat2f;
29 class FXMat4f;
30 
31 
33 class FXAPI FXMat3f {
34 protected:
35  FXVec3f m[3];
36 public:
37 
39  FXMat3f(){}
40 
42  FXMat3f(FXfloat s);
43 
45  FXMat3f(const FXMat2f& s);
46 
48  FXMat3f(const FXMat3f& s);
49 
51  FXMat3f(const FXMat4f& s);
52 
54  FXMat3f(const FXfloat s[]);
55 
57  FXMat3f(FXfloat a,FXfloat b,FXfloat c);
58 
60  FXMat3f(FXfloat a00,FXfloat a01,FXfloat a02,
61  FXfloat a10,FXfloat a11,FXfloat a12,
62  FXfloat a20,FXfloat a21,FXfloat a22);
63 
65  FXMat3f(const FXVec3f& a,const FXVec3f& b,const FXVec3f& c);
66 
68  FXMat3f(const FXQuatf& quat);
69 
71  FXMat3f& operator=(FXfloat s);
72 
74  FXMat3f& operator=(const FXMat2f& s);
75  FXMat3f& operator=(const FXMat3f& s);
76  FXMat3f& operator=(const FXMat4f& s);
77 
79  FXMat3f& operator=(const FXQuatf& quat);
80 
82  FXMat3f& operator=(const FXfloat s[]);
83 
85  FXMat3f& set(FXfloat s);
86 
88  FXMat3f& set(const FXMat2f& s);
89 
91  FXMat3f& set(const FXMat3f& s);
92 
94  FXMat3f& set(const FXMat4f& s);
95 
97  FXMat3f& set(const FXfloat s[]);
98 
100  FXMat3f& set(FXfloat a,FXfloat b,FXfloat c);
101 
103  FXMat3f& set(FXfloat a00,FXfloat a01,FXfloat a02,
104  FXfloat a10,FXfloat a11,FXfloat a12,
105  FXfloat a20,FXfloat a21,FXfloat a22);
106 
108  FXMat3f& set(const FXVec3f& a,const FXVec3f& b,const FXVec3f& c);
109 
111  FXMat3f& set(const FXQuatf& quat);
112 
114  FXMat3f& operator+=(const FXMat3f& w);
115  FXMat3f& operator-=(const FXMat3f& w);
116  FXMat3f& operator*=(const FXMat3f& w);
117  FXMat3f& operator*=(FXfloat w);
118  FXMat3f& operator/=(FXfloat w);
119 
121  FXVec3f& operator[](FXint i){return m[i];}
122  const FXVec3f& operator[](FXint i) const {return m[i];}
123 
125  operator FXfloat*(){return m[0];}
126  operator const FXfloat*() const {return m[0];}
127 
129  FXMat3f operator-() const;
130 
132  FXMat3f& identity();
133 
135  FXbool isIdentity() const;
136 
138  FXMat3f& rot(const FXQuatf& q);
139 
141  FXMat3f& rot(const FXVec3f& v,FXfloat c,FXfloat s);
142 
144  FXMat3f& rot(const FXVec3f& v,FXfloat phi);
145 
147  FXMat3f& xrot(FXfloat c,FXfloat s);
148  FXMat3f& xrot(FXfloat phi);
149 
151  FXMat3f& yrot(FXfloat c,FXfloat s);
152  FXMat3f& yrot(FXfloat phi);
153 
155  FXMat3f& zrot(FXfloat c,FXfloat s);
156  FXMat3f& zrot(FXfloat phi);
157 
159  FXMat3f& scale(FXfloat sx,FXfloat sy,FXfloat sz);
160  FXMat3f& scale(const FXVec3f& v);
161  FXMat3f& scale(FXfloat s);
162 
164  FXfloat det() const;
165 
167  FXMat3f transpose() const;
168 
170  FXMat3f invert() const;
171 
174  };
175 
176 
178 extern FXAPI FXVec2f operator*(const FXMat3f& m,const FXVec2f& v);
179 extern FXAPI FXVec3f operator*(const FXMat3f& m,const FXVec3f& v);
180 
182 extern FXAPI FXVec2f operator*(const FXVec2f& v,const FXMat3f& m);
183 extern FXAPI FXVec3f operator*(const FXVec3f& v,const FXMat3f& m);
184 
186 extern FXAPI FXMat3f operator+(const FXMat3f& a,const FXMat3f& b);
187 extern FXAPI FXMat3f operator-(const FXMat3f& a,const FXMat3f& b);
188 
190 extern FXAPI FXMat3f operator*(const FXMat3f& a,const FXMat3f& b);
191 
193 extern FXAPI FXMat3f operator*(FXfloat x,const FXMat3f& a);
194 extern FXAPI FXMat3f operator*(const FXMat3f& a,FXfloat x);
195 extern FXAPI FXMat3f operator/(const FXMat3f& a,FXfloat x);
196 extern FXAPI FXMat3f operator/(FXfloat x,const FXMat3f& a);
197 
199 extern FXAPI FXbool operator==(const FXMat3f& a,const FXMat3f& b);
200 extern FXAPI FXbool operator!=(const FXMat3f& a,const FXMat3f& b);
201 extern FXAPI FXbool operator==(const FXMat3f& a,FXfloat n);
202 extern FXAPI FXbool operator!=(const FXMat3f& a,FXfloat n);
203 extern FXAPI FXbool operator==(FXfloat n,const FXMat3f& a);
204 extern FXAPI FXbool operator!=(FXfloat n,const FXMat3f& a);
205 
207 extern FXAPI FXMat3f orthogonalize(const FXMat3f& m);
208 
210 extern FXAPI FXStream& operator<<(FXStream& store,const FXMat3f& m);
211 
213 extern FXAPI FXStream& operator>>(FXStream& store,FXMat3f& m);
214 
215 }
216 
217 #endif
~FXMat3f()
Destructor.
Definition: FXMat3f.h:173
Single-precision 3x3 matrix.
Definition: FXMat3f.h:33
FXVec3f & operator[](FXint i)
Indexing.
Definition: FXMat3f.h:121
Definition: FX4Splitter.h:28
Single-precision quaternion.
Definition: FXQuatf.h:32
Single-precision 3-element vector.
Definition: FXVec3f.h:28
Single-precision 4x4 matrix.
Definition: FXMat4f.h:32
Single-precision 2x2 matrix.
Definition: FXMat2f.h:31
FXMat3f()
Default constructor; value is not initialized.
Definition: FXMat3f.h:39

Copyright © 1997-2022 Jeroen van der Zijp