istereo
diff libs/vmath/vmath_types.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/vmath_types.h Thu Sep 08 08:30:42 2011 +0300 1.3 @@ -0,0 +1,40 @@ 1.4 +#ifndef VMATH_TYPES_H_ 1.5 +#define VMATH_TYPES_H_ 1.6 + 1.7 +#include "vmath_config.h" 1.8 + 1.9 +#define SMALL_NUMBER 1.e-4 1.10 +#define XSMALL_NUMBER 1.e-8 1.11 +#define ERROR_MARGIN 1.e-6 1.12 + 1.13 + 1.14 +#ifdef SINGLE_PRECISION_MATH 1.15 +typedef float scalar_t; 1.16 +#else 1.17 +typedef double scalar_t; 1.18 +#endif /* floating point precision */ 1.19 + 1.20 +/* vectors */ 1.21 +typedef struct { scalar_t x, y; } vec2_t; 1.22 +typedef struct { scalar_t x, y, z; } vec3_t; 1.23 +typedef struct { scalar_t x, y, z, w; } vec4_t; 1.24 + 1.25 +/* quaternions */ 1.26 +typedef vec4_t quat_t; 1.27 + 1.28 +/* matrices */ 1.29 +typedef scalar_t mat3_t[3][3]; 1.30 +typedef scalar_t mat4_t[4][4]; 1.31 + 1.32 + 1.33 +#ifdef __cplusplus 1.34 +class Vector2; 1.35 +class Vector3; 1.36 +class Vector4; 1.37 +class Quaternion; 1.38 +class Matrix3x3; 1.39 +class Matrix4x4; 1.40 +class SphVector; 1.41 +#endif /* __cplusplus */ 1.42 + 1.43 +#endif /* VMATH_TYPES_H_ */