Point3DSet.cpp

Go to the documentation of this file.
00001 
00011 #include "Point3DSet.h"
00012 #include "PCSIMException.h"
00013 
00014 #include <iostream>
00015 using std::cerr;
00016 using std::endl;
00017 
00018 size_t Point3DSet::getIndex( Point3D<double> const& p )
00019 {
00020   pointhash_t::iterator i = lookup.find( p );
00021   if ( i == lookup.end() ) {
00022      throw( PCSIM::NotFoundException( "Point3DSet::getIndex", "Point not found." ) );
00023   }
00024   return i->second;
00025 }
00026 
00027 size_t Point3DSet::getIndex(double x, double y, double z)
00028 {
00029   return getIndex( Point3D<double>(x,y,z) );
00030 }
00031 
00032 shared_ptr< Point3DSet > Point3DSet::subspace( SubSpaceConstraint const& cnstr ) const
00033 {
00034   return subset( *subspace_index( cnstr ) );
00035 }
00036 
00037 shared_ptr< vector<size_t> >  Point3DSet::subspace_index( SubSpaceConstraint const& cnstr ) const
00038 {
00039   shared_ptr< vector<size_t> > idx( new vector<size_t> );
00040   return idx;
00041 }
00042 
00043 shared_ptr< Point3DSet > Point3DSet::subset( vector<size_t> const& indices ) const
00044 {
00045    shared_ptr< Point3DSet > result( new Point3DSet( indices.size() ) );
00046    for( size_t i=0; i<indices.size(); i++ ) {
00047         size_t s = indices[i];
00048         if( s >= m_points.size() ) throw( PCSIM::Exception( "Point3DSet::subset", "Index out of range.") );
00049         result->setPoint( i, m_points[ s ] );
00050    }
00051    return result;
00052 }

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