Files Classes Functions Hierarchy
00001 #ifndef TRIANGLEPARTITION_H 00002 #define TRIANGLEPARTITION_H 00003 00004 #include <halfspaceD2.h> 00005 #include <partitionspace.h> 00006 #include <typedefs.h> 00007 00011 template< typename T, typename D > 00012 class trianglepartition : public partitionspace<T> 00013 { 00014 public: 00015 00017 T pi[3]; 00018 00021 halfspaceD2<T,D> hi[3]; 00022 00023 00025 trianglepartition 00026 ( 00027 T const & p0_, 00028 T const & p1_, 00029 T const & p2_ 00030 ); 00032 trianglepartition() {} 00034 void construct 00035 ( 00036 T const & p0_, 00037 T const & p1_, 00038 T const & p2_ 00039 ); 00040 00042 boolc isInside( T const & a) const; 00043 00044 }; 00045 00046 00047 00048 00049 // -------------------------------------------------------- 00050 // Implementation 00051 00052 template< typename T, typename D > 00053 trianglepartition<T,D>::trianglepartition 00054 ( 00055 T const & p0_, 00056 T const & p1_, 00057 T const & p2_ 00058 ) 00059 { 00060 construct(p0_,p1_,p2_); 00061 } 00062 00063 template< typename T, typename D > 00064 void trianglepartition<T,D>::construct 00065 ( 00066 T const & p0_, 00067 T const & p1_, 00068 T const & p2_ 00069 ) 00070 { 00071 pi[0] = p0_; 00072 pi[1] = p1_; 00073 pi[2] = p2_; 00074 00075 hi[0] = halfspaceD2<T,D>(pi[0],pi[1]); 00076 hi[1] = halfspaceD2<T,D>(pi[1],pi[2]); 00077 hi[2] = halfspaceD2<T,D>(pi[2],pi[0]); 00078 } 00079 00080 template< typename T, typename D > 00081 boolc trianglepartition<T,D>::isInside( T const & x ) const 00082 { 00083 for (uint i=0; i<3; ++i) 00084 if (!hi[i].isInside(x)) 00085 return false; 00086 00087 return true; 00088 } 00089 00090 00091 #endif 00092 00093
1.5.8