-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath3d.h
38 lines (25 loc) · 856 Bytes
/
math3d.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef _MATH3D_H
#define _MATH3D_H
#define MAX_DEGS 512
typedef float matrix_t[3][3];
typedef struct
{
float x, y, z;
} vector3d_t, point3d_t;
typedef struct
{
float x, y;
} point2d_t;
extern float sine[MAX_DEGS], cosine[MAX_DEGS];
void compute_lookup_tables();
void compute_rotation_matrix(matrix_t m, int ax, int ay, int az);
void transform_vector(vector3d_t* v, matrix_t m, vector3d_t* o);
void copy_vector(vector3d_t* o, vector3d_t* v);
void scale_vector(float s, vector3d_t* v, vector3d_t* o);
void add_vector(vector3d_t* a, vector3d_t* b, vector3d_t* o);
void subtract_vector(vector3d_t* a, vector3d_t* b, vector3d_t* o);
float normalize_vector(vector3d_t* v);
void cross_product(vector3d_t* o, vector3d_t* a, vector3d_t* b);
float dot_product(vector3d_t* a, vector3d_t* b);
float vector_len(vector3d_t* v);
#endif // _MATH3D_H