Point3DSet.h

Go to the documentation of this file.
00001 
00010 #ifndef POINT3DSET_H
00011 #define POINT3DSET_H
00012 
00013 #include <vector>
00014 using std::vector;
00015 
00016 #include <boost/shared_ptr.hpp>
00017 using boost::shared_ptr;
00018 
00019 #include "pcsim_hash.h"
00020 
00021 #include "Point3D.h"
00022 #include "SubSpaceConstraint.h"
00023 #include "Point3DSetSpliter.h"
00024 
00026 
00030 class Point3DSet {
00031 
00032     public:
00033 
00035         Point3DSet( size_t n = 0 ) {
00036             m_points.resize(n);
00037         };
00038 
00040         Point3DSet(  vector< Point3D<double> > const& initpoints )
00041                 : m_points( initpoints ) {
00042             for( size_t i = 0; i < m_points.size(); i++ )
00043                 lookup[ m_points[i] ] = i;
00044         };
00045 
00047         virtual ~Point3DSet() {
00048             /* NOOP */
00049         };
00050 
00052         size_t size() const {
00053             return m_points.size();
00054         };
00055 
00057         Point3D<double> const& operator[]( int i ) const {
00058             return m_points[i];
00059         };
00060 
00062         vector< Point3D<double> > const& points() const {
00063           return m_points;
00064         };
00065         
00067         void append( Point3D<double> const& p ) {
00068           m_points.push_back( p );
00069           lookup[p] = m_points.size()-1;
00070         }
00071 
00073         virtual size_t getIndex( Point3D<double> const& p );
00074 
00076         virtual size_t getIndex( double x, double y, double z );
00077 
00079         shared_ptr< Point3DSet > subset( vector<size_t> const& indices ) const;
00080 
00082         shared_ptr< Point3DSet > subspace( SubSpaceConstraint const& cnstr ) const;
00083 
00085         shared_ptr< vector<size_t> > subspace_index( SubSpaceConstraint const& cnstr ) const;
00086 
00088         shared_ptr< vector< shared_ptr<Point3DSet> > > split( Point3DSetSpliter & splitter )
00089         {
00090           return splitter.split( *this );
00091         }
00092 
00094         shared_ptr< vector< shared_ptr<Point3DSet> > > split( shared_ptr<Point3DSetSpliter> splitter )
00095         {
00096           return splitter->split( *this );
00097         }
00098 
00100         inline void python_exposer( vector< shared_ptr<Point3DSet> > ) {};
00101 
00102         void setPoint( size_t i, Point3D<double> const& p ) {
00103           m_points[i] = p;
00104           lookup[p] = i;
00105         }
00106 
00107     protected:
00108               
00109         vector< Point3D<double> > m_points;
00110         typedef hash_map< Point3D<double> , size_t, PCSIM::hash< Point3D<double> > > pointhash_t;
00111         pointhash_t lookup;
00112 
00113 };
00114 
00115 #endif

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5