include/crbn/basic/trihedron.hpp

00001 
00002 #ifndef __trihedron_hpp__
00003 #define __trihedron_hpp__
00004 
00005 #include <crbn/basic/vec3.hpp>
00006 #include <crbn/basic/fastmath.h>
00007 
00008 // a right hand trihedron
00009 
00010 struct trihedron {
00011   vec3 x;
00012   vec3 y;
00013   vec3 z;
00014 };
00015 
00016 inline void compute( trihedron& t, vec3& v ) {
00017   vec3 tmp;
00018   if( fm_abs( v.x ) < .5f )
00019     tmp = vec3( 1.f, 0.f, 0.f );
00020   else
00021     tmp = vec3( 0.f, 1.f, 0.f );
00022   vcross( t.x, v, tmp );
00023   vnormalize( t.x );
00024   vcross( t.y, t.x, v );
00025   vnormalize( t.y );
00026   vnormalize( t.z, v );
00027 }
00028 
00029 #endif // __trihedron_hpp__

Generated on Tue Nov 14 15:40:08 2006 for libcrbn by  doxygen 1.5.0