1
Dependencies: CircularBuffer Radio Servo Terminal mbed
Fork of WalkingRobot by
Matrix.h@11:975d24305af7, 2013-04-09 (annotated)
- Committer:
- alex03
- Date:
- Tue Apr 09 01:40:27 2013 +0000
- Revision:
- 11:975d24305af7
- Parent:
- 5:475f67175510
g
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pclary | 3:6fa07ceb897f | 1 | #ifndef MATRIX_H |
pclary | 3:6fa07ceb897f | 2 | #define MATRIX_H |
pclary | 3:6fa07ceb897f | 3 | |
pclary | 3:6fa07ceb897f | 4 | |
pclary | 3:6fa07ceb897f | 5 | |
pclary | 3:6fa07ceb897f | 6 | struct vector3 |
pclary | 3:6fa07ceb897f | 7 | { |
pclary | 3:6fa07ceb897f | 8 | float x, y, z; |
pclary | 3:6fa07ceb897f | 9 | vector3() {} |
pclary | 3:6fa07ceb897f | 10 | vector3(float x1, float y1, float z1) { x = x1; y = y1; z = z1; } |
pclary | 5:475f67175510 | 11 | vector3 operator+(const vector3& v) const; |
pclary | 5:475f67175510 | 12 | vector3 operator-(const vector3& v) const; |
pclary | 5:475f67175510 | 13 | vector3 operator*(const float f) const; |
pclary | 5:475f67175510 | 14 | vector3 unit() const; |
pclary | 3:6fa07ceb897f | 15 | }; |
pclary | 3:6fa07ceb897f | 16 | |
pclary | 3:6fa07ceb897f | 17 | |
pclary | 3:6fa07ceb897f | 18 | |
pclary | 3:6fa07ceb897f | 19 | struct matrix4 |
pclary | 3:6fa07ceb897f | 20 | { |
pclary | 3:6fa07ceb897f | 21 | float a11, a12, a13, a14; |
pclary | 3:6fa07ceb897f | 22 | float a21, a22, a23, a24; |
pclary | 3:6fa07ceb897f | 23 | float a31, a32, a33, a34; |
pclary | 3:6fa07ceb897f | 24 | // Bottom row is always 0, 0, 0, 1 |
pclary | 3:6fa07ceb897f | 25 | |
pclary | 3:6fa07ceb897f | 26 | matrix4(); |
pclary | 3:6fa07ceb897f | 27 | matrix4& identity(); |
pclary | 3:6fa07ceb897f | 28 | matrix4& translate(vector3 v); |
pclary | 3:6fa07ceb897f | 29 | matrix4& rotateX(float radians); |
pclary | 3:6fa07ceb897f | 30 | matrix4& rotateY(float radians); |
pclary | 3:6fa07ceb897f | 31 | matrix4& rotateZ(float radians); |
pclary | 3:6fa07ceb897f | 32 | matrix4 operator*(const matrix4& other) const; |
pclary | 3:6fa07ceb897f | 33 | vector3 operator*(const vector3& other) const; |
pclary | 3:6fa07ceb897f | 34 | matrix4 inverse() const; |
pclary | 3:6fa07ceb897f | 35 | }; |
pclary | 3:6fa07ceb897f | 36 | |
pclary | 3:6fa07ceb897f | 37 | #endif // MATRIX_H |