/Users/jack/Code/basso_dev/inc/geometry.h

00001 
00013 #ifndef _GEOMETRY_FUNCTIONS_BASSO_H_
00014 #define _GEOMETRY_FUNCTIONS_BASSO_H_
00015 
00016 // std includes
00017 
00018 // Gmm++ includes
00019 
00020 // Basso includes
00021 #include "basso.h"
00022 #include "Point.h"
00023 
00024 namespace basso {
00025 
00031         Numeric area_triangle( const Point &a, const Point &b, const Point &c )
00032         {
00033                 Numeric x1=a.x(),  y1=a.y(),  z1=a.z();
00034                 Numeric x2=b.x(),  y2=b.y(),  z2=b.z();
00035                 Numeric x3=c.x(),  y3=c.y(),  z3=c.z();
00036                 return 0.5*(-x2*y1 + x3*y1 + x1*y2 - x3*y2 - x1*y3 + x2*y3 + x2*z1 - x3*z1 - 
00037                                 y2*z1 + y3*z1 - x1*z2 + x3*z2 + y1*z2 - y3*z2 + x1*z3 - x2*z3 - 
00038                                 y1*z3 + y2*z3);
00039         }
00040 
00042         Numeric dist( const Point &p1, const Point &p2 ) 
00043         { 
00044                 return sqrt( pow(p1.x()-p2.x(),2) + pow(p1.y()-p2.y(),2) + pow(p1.z()-p2.z(),2) );
00045         }
00046 
00048         class FiniteLine 
00049         {
00050         public:
00051                 FiniteLine( const Point &a, const Point &b ) { p0=a; p1=b; }
00052                 
00053         protected:
00054                 Point p0, p1;
00055                 
00056         };
00057         
00058 } // end namespace
00059 
00060 #endif

Generated on Sat Jan 19 09:03:57 2008 for Basso by  doxygen 1.5.2