istereo
diff libs/vmath/basis.h @ 28:c0ae8e668447
added vmath library
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 08 Sep 2011 08:30:42 +0300 |
parents | |
children | ff055bff6a15 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/vmath/basis.h Thu Sep 08 08:30:42 2011 +0300 1.3 @@ -0,0 +1,39 @@ 1.4 +#ifndef VMATH_BASIS_H_ 1.5 +#define VMATH_BASIS_H_ 1.6 + 1.7 +#include "vector.h" 1.8 +#include "matrix.h" 1.9 + 1.10 +enum { 1.11 + LEFT_HANDED, 1.12 + RIGHT_HANDED 1.13 +}; 1.14 + 1.15 +#ifdef __cplusplus 1.16 +extern "C" { 1.17 +#endif /* __cplusplus */ 1.18 + 1.19 +void basis_matrix(mat4_t res, vec3_t i, vec3_t j, vec3_t k); 1.20 +void basis_matrix_dir(mat4_t res, vec3_t dir); 1.21 + 1.22 +#ifdef __cplusplus 1.23 +} /* extern "C" */ 1.24 + 1.25 +class Basis { 1.26 +public: 1.27 + Vector3 i, j, k; 1.28 + 1.29 + Basis(); 1.30 + Basis(const Vector3 &i, const Vector3 &j, const Vector3 &k); 1.31 + Basis(const Vector3 &dir, bool left_handed = true); 1.32 + 1.33 + void rotate(scalar_t x, scalar_t y, scalar_t z); 1.34 + void rotate(const Vector3 &axis, scalar_t angle); 1.35 + void rotate(const Matrix4x4 &mat); 1.36 + void rotate(const Quaternion &quat); 1.37 + 1.38 + Matrix3x3 create_rotation_matrix() const; 1.39 +}; 1.40 +#endif /* __cplusplus */ 1.41 + 1.42 +#endif /* VMATH_BASIS_H_ */