geometry.cpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2006, Michael Kazhdan and Matthew Bolitho
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification,
00006 are permitted provided that the following conditions are met:
00007 
00008 Redistributions of source code must retain the above copyright notice, this list of
00009 conditions and the following disclaimer. Redistributions in binary form must reproduce
00010 the above copyright notice, this list of conditions and the following disclaimer
00011 in the documentation and/or other materials provided with the distribution. 
00012 
00013 Neither the name of the Johns Hopkins University nor the names of its contributors
00014 may be used to endorse or promote products derived from this software without specific
00015 prior written permission. 
00016 
00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00018 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
00019 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00020 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00021 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00022 TO, PROCUREMENT OF SUBSTITUTE  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00023 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00025 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00026 DAMAGE.
00027 */
00028 #include <pcl/surface/3rdparty/poisson4/geometry.h>
00029 
00031 // CoredMeshData //
00033 namespace pcl
00034 {
00035   namespace poisson
00036   {
00037 
00038     TriangulationEdge::TriangulationEdge(void){pIndex[0]=pIndex[1]=tIndex[0]=tIndex[1]=-1;}
00039     TriangulationTriangle::TriangulationTriangle(void){eIndex[0]=eIndex[1]=eIndex[2]=-1;}
00040 
00042     // CoredVectorMeshData //
00044     CoredVectorMeshData::CoredVectorMeshData( void ) { oocPointIndex = polygonIndex = 0; }
00045     void CoredVectorMeshData::resetIterator ( void ) { oocPointIndex = polygonIndex = 0; }
00046     int CoredVectorMeshData::addOutOfCorePoint(const Point3D<float>& p){
00047       oocPoints.push_back(p);
00048       return int(oocPoints.size())-1;
00049     }
00050     int CoredVectorMeshData::addPolygon( const std::vector< CoredVertexIndex >& vertices )
00051     {
00052       std::vector< int > polygon( vertices.size() );
00053       for( int i=0 ; i<int(vertices.size()) ; i++ )
00054         if( vertices[i].inCore ) polygon[i] =  vertices[i].idx;
00055         else                     polygon[i] = -vertices[i].idx-1;
00056       polygons.push_back( polygon );
00057       return int( polygons.size() )-1;
00058     }
00059     int CoredVectorMeshData::nextOutOfCorePoint(Point3D<float>& p){
00060       if(oocPointIndex<int(oocPoints.size())){
00061         p=oocPoints[oocPointIndex++];
00062         return 1;
00063       }
00064       else{return 0;}
00065     }
00066     int CoredVectorMeshData::nextPolygon( std::vector< CoredVertexIndex >& vertices )
00067     {
00068       if( polygonIndex<int( polygons.size() ) )
00069       {
00070         std::vector< int >& polygon = polygons[ polygonIndex++ ];
00071         vertices.resize( polygon.size() );
00072         for( int i=0 ; i<int(polygon.size()) ; i++ )
00073           if( polygon[i]<0 ) vertices[i].idx = -polygon[i]-1 , vertices[i].inCore = false;
00074           else               vertices[i].idx =  polygon[i]   , vertices[i].inCore = true;
00075         return 1;
00076       }
00077       else return 0;
00078     }
00079     int CoredVectorMeshData::outOfCorePointCount(void){return int(oocPoints.size());}
00080     int CoredVectorMeshData::polygonCount( void ) { return int( polygons.size() ); }
00081 
00083     // CoredVectorMeshData //
00085     CoredVectorMeshData2::CoredVectorMeshData2( void ) { oocPointIndex = polygonIndex = 0; }
00086     void CoredVectorMeshData2::resetIterator ( void ) { oocPointIndex = polygonIndex = 0; }
00087     int CoredVectorMeshData2::addOutOfCorePoint( const CoredMeshData2::Vertex& v )
00088     {
00089       oocPoints.push_back( v );
00090       return int(oocPoints.size())-1;
00091     }
00092     int CoredVectorMeshData2::addPolygon( const std::vector< CoredVertexIndex >& vertices )
00093     {
00094       std::vector< int > polygon( vertices.size() );
00095       for( int i=0 ; i<int(vertices.size()) ; i++ )
00096         if( vertices[i].inCore ) polygon[i] =  vertices[i].idx;
00097         else                     polygon[i] = -vertices[i].idx-1;
00098       polygons.push_back( polygon );
00099       return int( polygons.size() )-1;
00100     }
00101     int CoredVectorMeshData2::nextOutOfCorePoint( CoredMeshData2::Vertex& v )
00102     {
00103       if(oocPointIndex<int(oocPoints.size()))
00104       {
00105         v = oocPoints[oocPointIndex++];
00106         return 1;
00107       }
00108       else{return 0;}
00109     }
00110     int CoredVectorMeshData2::nextPolygon( std::vector< CoredVertexIndex >& vertices )
00111     {
00112       if( polygonIndex<int( polygons.size() ) )
00113       {
00114         std::vector< int >& polygon = polygons[ polygonIndex++ ];
00115         vertices.resize( polygon.size() );
00116         for( int i=0 ; i<int(polygon.size()) ; i++ )
00117           if( polygon[i]<0 ) vertices[i].idx = -polygon[i]-1 , vertices[i].inCore = false;
00118           else               vertices[i].idx =  polygon[i]   , vertices[i].inCore = true;
00119         return 1;
00120       }
00121       else return 0;
00122     }
00123     int CoredVectorMeshData2::outOfCorePointCount(void){return int(oocPoints.size());}
00124     int CoredVectorMeshData2::polygonCount( void ) { return int( polygons.size() ); }
00125 
00126   }
00127 }


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:24:25