goat3d
view libs/vmath/vmath_types.h @ 51:fa5c52ea9d59
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 17 Jan 2014 18:16:09 +0200 |
parents | |
children |
line source
1 /*
2 libvmath - a vector math library
3 Copyright (C) 2004-2011 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published
7 by the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
19 #ifndef VMATH_TYPES_H_
20 #define VMATH_TYPES_H_
22 #include "vmath_config.h"
24 #define SMALL_NUMBER 1.e-4
25 #define XSMALL_NUMBER 1.e-8
26 #define ERROR_MARGIN 1.e-6
29 #ifdef SINGLE_PRECISION_MATH
30 typedef float scalar_t;
31 #else
32 typedef double scalar_t;
33 #endif /* floating point precision */
35 /* vectors */
36 typedef struct { scalar_t x, y; } vec2_t;
37 typedef struct { scalar_t x, y, z; } vec3_t;
38 typedef struct { scalar_t x, y, z, w; } vec4_t;
40 /* quaternions */
41 typedef vec4_t quat_t;
43 /* matrices */
44 typedef scalar_t mat3_t[3][3];
45 typedef scalar_t mat4_t[4][4];
48 #ifdef __cplusplus
49 class Vector2;
50 class Vector3;
51 class Vector4;
52 class Quaternion;
53 class Matrix3x3;
54 class Matrix4x4;
55 class SphVector;
56 #endif /* __cplusplus */
58 #endif /* VMATH_TYPES_H_ */