Changeset 5378
 Timestamp:
 May 29, 2008, 10:05:54 AM (15 years ago)
 Location:
 anuga_work/development/anugavis/src
 Files:

 1 deleted
 2 edited
Legend:
 Unmodified
 Added
 Removed

anuga_work/development/anugavis/src/Makefile.am
r5292 r5378 18 18 netcdf_util.h \ 19 19 vector.c \ 20 vector.h \21 20 xfunctions.c \ 22 21 xfunctions.h 
anuga_work/development/anugavis/src/vector.h
r5339 r5378 2 2 #define VECTOR_H 3 3 4 #include <math.h> 5 4 6 typedef float vector[3]; 7 5 8 /* Useful vector operations. */ 6 extern void vadd(const vector v1, const vector v2, vector result); 7 extern float vlen(const vector v); 8 extern void vscale(const vector v, const float scale, vector result); 9 extern void vsub(const vector v1, const vector v2, vector result); 10 extern float vdot(const vector v1, const vector v2); 11 extern void vcross(const vector v1, const vector v2, vector result); 9 static inline void vadd(const vector v1, const vector v2, vector result){ 10 int i; 11 for(i = 0 ; i < 3 ; i++) result[i] = v1[i] + v2[i]; 12 } 13 14 static inline float vlen(const vector v){ 15 return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); 16 } 17 18 static inline void vscale(const vector v, const float scale, vector result){ 19 int i; 20 for(i = 0 ; i < 3 ; i++) result[i] = scale * v[i]; 21 } 22 23 static inline void vsub(const vector v1, const vector v2, vector result){ 24 int i; 25 for(i = 0 ; i < 3 ; i++) result[i] = v1[i]  v2[i]; 26 } 27 28 static inline float vdot(const vector v1, const vector v2){ 29 int i; 30 float rv = 0; 31 for(i = 0 ; i < 3 ; i++) rv += v1[i] * v2[i]; 32 return rv; 33 } 34 35 static inline void vcross(const vector v1, const vector v2, vector result){ 36 result[0] = v1[1] * v2[2]  v1[2] * v2[1]; 37 result[1] = v1[2] * v2[0]  v1[0] * v2[2]; 38 result[2] = v1[0] * v2[1]  v1[1] * v2[0]; 39 } 12 40 13 41 #endif
Note: See TracChangeset
for help on using the changeset viewer.