1 |
/* RCSid: $Id: vect.h,v 1.3 2003/06/07 01:11:17 schorsch Exp $ */ |
2 |
#ifndef _MGF_VECT_H_ |
3 |
#define _MGF_VECT_H_ |
4 |
#ifdef __cplusplus |
5 |
extern "C" { |
6 |
#endif |
7 |
|
8 |
|
9 |
#include <stdio.h> |
10 |
|
11 |
typedef float Vector[3]; |
12 |
|
13 |
#define X 0 |
14 |
#define Y 1 |
15 |
#define Z 2 |
16 |
|
17 |
/* Transformation matrix */ |
18 |
typedef float Matrix[4][4]; |
19 |
|
20 |
void vect_init (Vector v, float x, float y, float z); |
21 |
void vect_copy (Vector v1, Vector v2); |
22 |
int vect_equal (Vector v1, Vector v2); |
23 |
void vect_add (Vector v1, Vector v2, Vector v3); |
24 |
void vect_sub (Vector v1, Vector v2, Vector v3); |
25 |
void vect_scale (Vector v1, Vector v2, float k); |
26 |
float vect_mag (Vector v); |
27 |
void vect_normalize (Vector v); |
28 |
float vect_dot (Vector v1, Vector v2); |
29 |
void vect_cross (Vector v1, Vector v2, Vector v3); |
30 |
void vect_min (Vector v1, Vector v2, Vector v3); |
31 |
void vect_max (Vector v1, Vector v2, Vector v3); |
32 |
float vect_angle (Vector v1, Vector v2); |
33 |
void vect_print (FILE *f, Vector v, int dec, char sep); |
34 |
void vect_rotate (Vector v1, Vector v2, int axis, float angle); |
35 |
void vect_axis_rotate (Vector v1, Vector v2, Vector axis, float angle); |
36 |
void mat_identity (Matrix mat); |
37 |
void mat_copy (Matrix mat1, Matrix mat2); |
38 |
void mat_rotate (Matrix mat1, Matrix mat2, int axis, float angle); |
39 |
void mat_axis_rotate (Matrix mat1, Matrix mat2, Vector axis, float angle); |
40 |
void mat_mult (Matrix mat1, Matrix mat2, Matrix mat3); |
41 |
void vect_transform (Vector v1, Vector v2, Matrix mat); |
42 |
void mat_decode (Matrix mat, Vector scale, Vector shear, Vector rotate, Vector |
43 |
transl); |
44 |
float mat_inv (Matrix mat1, Matrix mat2); |
45 |
|
46 |
|
47 |
#ifdef __cplusplus |
48 |
} |
49 |
#endif |
50 |
#endif /* _MGF_VECT_H_ */ |