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