istereo

view 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 source
1 #ifndef VMATH_TYPES_H_
2 #define VMATH_TYPES_H_
4 #include "vmath_config.h"
6 #define SMALL_NUMBER 1.e-4
7 #define XSMALL_NUMBER 1.e-8
8 #define ERROR_MARGIN 1.e-6
11 #ifdef SINGLE_PRECISION_MATH
12 typedef float scalar_t;
13 #else
14 typedef double scalar_t;
15 #endif /* floating point precision */
17 /* vectors */
18 typedef struct { scalar_t x, y; } vec2_t;
19 typedef struct { scalar_t x, y, z; } vec3_t;
20 typedef struct { scalar_t x, y, z, w; } vec4_t;
22 /* quaternions */
23 typedef vec4_t quat_t;
25 /* matrices */
26 typedef scalar_t mat3_t[3][3];
27 typedef scalar_t mat4_t[4][4];
30 #ifdef __cplusplus
31 class Vector2;
32 class Vector3;
33 class Vector4;
34 class Quaternion;
35 class Matrix3x3;
36 class Matrix4x4;
37 class SphVector;
38 #endif /* __cplusplus */
40 #endif /* VMATH_TYPES_H_ */