Back to index

radiance  4R0+20100331
vect.h
Go to the documentation of this file.
00001 /* RCSid: $Id: vect.h,v 1.3 2003/06/07 01:11:17 schorsch Exp $ */
00002 #ifndef _MGF_VECT_H_
00003 #define _MGF_VECT_H_
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 
00008 
00009 #include <stdio.h>
00010 
00011 typedef float Vector[3];
00012 
00013 #define X 0
00014 #define Y 1
00015 #define Z 2
00016 
00017 /* Transformation matrix */
00018 typedef float Matrix[4][4];
00019 
00020 void vect_init (Vector v, float x, float y, float z);
00021 void vect_copy (Vector v1, Vector v2);
00022 int vect_equal (Vector v1, Vector v2);
00023 void vect_add (Vector v1, Vector v2, Vector v3);
00024 void vect_sub (Vector v1, Vector v2, Vector v3);
00025 void vect_scale (Vector v1, Vector v2, float k);
00026 float vect_mag (Vector v);
00027 void vect_normalize (Vector v);
00028 float vect_dot (Vector v1, Vector v2);
00029 void vect_cross (Vector v1, Vector v2, Vector v3);
00030 void vect_min (Vector v1, Vector v2, Vector v3);
00031 void vect_max (Vector v1, Vector v2, Vector v3);
00032 float vect_angle (Vector v1, Vector v2);
00033 void vect_print (FILE *f, Vector v, int dec, char sep);
00034 void vect_rotate (Vector v1, Vector v2, int axis, float angle);
00035 void vect_axis_rotate (Vector v1, Vector v2, Vector axis, float angle);
00036 void mat_identity (Matrix mat);
00037 void mat_copy (Matrix mat1, Matrix mat2);
00038 void mat_rotate (Matrix mat1, Matrix mat2, int axis, float angle);
00039 void mat_axis_rotate (Matrix mat1, Matrix mat2, Vector axis, float angle);
00040 void mat_mult (Matrix mat1, Matrix mat2, Matrix mat3);
00041 void vect_transform (Vector v1, Vector v2, Matrix mat);
00042 void mat_decode (Matrix mat, Vector scale, Vector shear, Vector rotate, Vector
00043         transl);
00044 float mat_inv (Matrix mat1, Matrix mat2);
00045 
00046 
00047 #ifdef __cplusplus
00048 }
00049 #endif
00050 #endif /* _MGF_VECT_H_ */