Files Classes Functions Hierarchy
00001 #ifndef HALFSPACECONTAINER_H 00002 #define HALFSPACECONTAINER_H 00003 00004 #include <list> 00005 #include <iostream> 00006 using namespace std; 00007 00008 #include <typedefs.h> 00009 00014 template<typename HS, typename PT > 00015 class halfspaceContainer 00016 { 00017 public: 00018 00020 HS halfspace; 00021 00023 list<uint> index; 00024 00026 vector< PT > const & pts; 00027 00030 halfspaceContainer 00031 ( 00032 HS const & halfspace_, 00033 vector< PT > const & pts_ 00034 ) : halfspace(halfspace_), pts(pts_) {} 00035 00038 void isInsideOrOnBoundary(list<uint> const & target); 00039 00042 void subtractfrom( list<uint> & target ); 00043 00044 }; 00045 00046 //--------------------------------------------------------- 00047 // Implementation 00048 00049 template< typename HS, typename PT > 00050 void halfspaceContainer<HS,PT>::subtractfrom 00051 ( 00052 list<uint> & target 00053 ) 00054 { 00055 list<uint>::iterator i=target.begin(); 00056 for ( ; i!=target.end(); ++i) 00057 { 00058 if (halfspace.isInsideOrOnBoundary(pts[*i])) 00059 { 00060 index.push_back(*i); 00061 i=target.erase(i); 00062 } 00063 } 00064 } 00065 00066 template< typename HS, typename PT > 00067 void halfspaceContainer<HS,PT>::isInsideOrOnBoundary 00068 ( 00069 list<uint> const & target 00070 ) 00071 { 00072 list< uint >::const_iterator i=target.begin(); 00073 list< uint >::const_iterator iend=target.end(); 00074 for ( ; i!=iend; ++i) 00075 { 00076 if (halfspace.isInsideOrOnBoundary(pts[*i])) 00077 index.push_back(*i); 00078 } 00079 } 00080 00081 #endif 00082 00083
1.5.8