1 | /* |
---|
2 | |
---|
3 | Brian Curless |
---|
4 | |
---|
5 | Computer Graphics Laboratory |
---|
6 | Stanford University |
---|
7 | |
---|
8 | --------------------------------------------------------------------- |
---|
9 | |
---|
10 | Copyright (1997) The Board of Trustees of the Leland Stanford Junior |
---|
11 | University. Except for commercial resale, lease, license or other |
---|
12 | commercial transactions, permission is hereby given to use, copy, |
---|
13 | modify this software for academic purposes only. No part of this |
---|
14 | software or any derivatives thereof may be used in the production of |
---|
15 | computer models for resale or for use in a commercial |
---|
16 | product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND |
---|
17 | CONCERNING THIS SOFTWARE. No support is implied or provided. |
---|
18 | |
---|
19 | */ |
---|
20 | |
---|
21 | |
---|
22 | #ifndef _MATRIX3F_ |
---|
23 | #define _MATRIX3F_ |
---|
24 | |
---|
25 | #include "Vec3f.h" |
---|
26 | #include "defines.h" |
---|
27 | |
---|
28 | class Matrix3f { |
---|
29 | friend class Vec3f; |
---|
30 | |
---|
31 | public: |
---|
32 | float m[3][3]; |
---|
33 | |
---|
34 | Matrix3f() {} |
---|
35 | Matrix3f(const Matrix3f &a) {setValue(a);} |
---|
36 | Matrix3f(float a[][3]) {setValue(a);} |
---|
37 | Matrix3f(float *a0, float *a1, float *a2) {setValue(a0, a1, a2);} |
---|
38 | Matrix3f(Vec3f a0, Vec3f a1, Vec3f a2) {setValue(a0, a1, a2);} |
---|
39 | Matrix3f(float a00, float a01, float a02, |
---|
40 | float a10, float a11, float a12, |
---|
41 | float a20, float a21, float a22) |
---|
42 | { setValue(a00, a01, a02, a10, a11, a12, a20, a21, a22); } |
---|
43 | void clear() {setValue(0,0,0,0,0,0,0,0,0);} |
---|
44 | void makeIdentity(); |
---|
45 | void setValue(const Matrix3f &a); |
---|
46 | void setValue(float a[][3]); |
---|
47 | void setValue(float *a0, float *a1, float *a2); |
---|
48 | void setValue(Vec3f a0, Vec3f a1, Vec3f a2); |
---|
49 | void setValue(float a00, float a01, float a02, |
---|
50 | float a10, float a11, float a12, |
---|
51 | float a20, float a21, float a22); |
---|
52 | Vec3f mult(Vec3f &vec); |
---|
53 | float elem(int i, int j) {return m[i][j];} |
---|
54 | void setElem(int i, int j, float val) {m[i][j] = val;} |
---|
55 | Matrix3f& operator +=(const Matrix3f &a); |
---|
56 | float determinant(); |
---|
57 | int operator==(const Matrix3f &); |
---|
58 | int operator!=(const Matrix3f &); |
---|
59 | Matrix3f & operator*=(float); |
---|
60 | Matrix3f inverse() const; |
---|
61 | void map(const Vec3f vin[3], const Vec3f vout[3]); |
---|
62 | void toNR(Matrix3f &in, float **nrmat) const; |
---|
63 | void setScale(float s); |
---|
64 | void setScale(float sx, float sy, float sz); |
---|
65 | void setScale(const Vec3f &s); |
---|
66 | Matrix3f & multLeft(const Matrix3f &m); |
---|
67 | }; |
---|
68 | |
---|
69 | #endif |
---|