libvmath4
view src/matrix.inl @ 0:4d6383605d64
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 05 Oct 2014 04:00:05 +0300 |
parents | |
children |
line source
1 #include <string.h>
3 Matrix3x3 Matrix3x3::id = Matrix3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
4 Matrix4x4 Matrix4x4::id = Matrix4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
6 Matrix3x3::Matrix3x3()
7 {
8 memcpy(m, Matrix3x3::id.m, sizeof m);
9 }
11 Matrix3x3::Matrix3x3(const float *m)
12 {
13 memcpy(this->m, m, sizeof this->m);
14 }
16 Matrix3x3::Matrix3x3(float m00, float m01, float m02,
17 float m10, float m11, float m12,
18 float m20, float m21, float m22)
19 {
20 m[0][0] = m00; m[0][1] = m01; m[0][2] = m02;
21 m[1][0] = m10; m[1][1] = m11; m[1][2] = m12;
22 m[2][0] = m20; m[2][1] = m21; m[2][2] = m22;
23 }
26 Matrix4x4::Matrix4x4()
27 {
28 memcpy(m, Matrix4x4::id.m, sizeof m);
29 }
31 Matrix4x4::Matrix4x4(const float *m)
32 {
33 memcpy(this->m, m, sizeof this->m);
34 }
36 Matrix4x4::Matrix4x4(float m00, float m01, float m02, float m03,
37 float m10, float m11, float m12, float m13,
38 float m20, float m21, float m22, float m23,
39 float m30, float m31, float m32, float m33)
40 {
41 m[0][0] = m00; m[0][1] = m01; m[0][2] = m02; m[0][3] = m03;
42 m[1][0] = m10; m[1][1] = m11; m[1][2] = m12; m[1][3] = m13;
43 m[2][0] = m20; m[2][1] = m21; m[2][2] = m22; m[2][3] = m23;
44 m[3][0] = m20; m[3][1] = m21; m[3][2] = m22; m[3][3] = m23;
45 }