summaryrefslogtreecommitdiff
path: root/common/matrix.h
diff options
context:
space:
mode:
authordocwhat1999-11-14 06:43:18 +0000
committerdocwhat1999-11-14 06:43:18 +0000
commitd71eec8062e852e56f03102ba4b4e87dc485821d (patch)
tree452368ad0e7e24627e517a0c88c2508d02cea6dc /common/matrix.h
parent2046090b7ce8dd901ce43e650be5acf44016d714 (diff)
Initial revision
git-svn-id: http://svn.leocad.org/trunk@2 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/matrix.h')
-rw-r--r--common/matrix.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/common/matrix.h b/common/matrix.h
new file mode 100644
index 0000000..41110d9
--- /dev/null
+++ b/common/matrix.h
@@ -0,0 +1,45 @@
+// Matrix class
+//
+
+#ifndef _MATRIX_H_
+#define _MATRIX_H_
+
+class File;
+
+class Matrix
+{
+public:
+ Matrix();
+ Matrix(float* floats);
+ Matrix(double mat[16]);
+ Matrix(float rot[4], float pos[3]);
+ ~Matrix();
+
+ void WriteToFile (File* F);
+ void ReadFromFile (File* F);
+ void Multiply (Matrix& m1, Matrix& m2);
+ void ConvertToLDraw(float f[12]);
+ void ConvertFromLDraw(float f[12]);
+ void GetEulerAngles (float rot[3]);
+ void LoadIdentity();
+ void GetTranslation(float *x, float *y, float *z);
+ void SetTranslation(float x, float y, float z);
+ void GetTranslation(float pos[3]);
+ void SetTranslation(float pos[3]);
+ void TransformPoint(float out[], const float in[3]);
+ void TransformPoints (float p[], int n);
+ void Create (float mx, float my, float mz, float rx, float ry, float rz);
+ void CreateOld(float mx, float my, float mz, float rx, float ry, float rz);
+ void Rotate(float angle, float x, float y, float z);
+ void RotateCenter(float angle, float x, float y, float z, float px, float py, float pz);
+ void Translate(float x, float y, float z);
+ void FromEuler(float yaw, float pitch, float roll);
+ void ToAxisAngle(float rot[4]);
+ void FromAxisAngle(float axis[3], float angle);
+ void FromFloat(float* mat);
+ bool FromInverse(double* src);
+
+ float m[16];
+};
+
+#endif //_MATRIX_H_