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