mirror of
https://github.com/CloudCompare/PoissonRecon.git
synced 2026-08-30 17:10:28 +08:00
Version9.0
This commit is contained in:
+11
-10
@@ -26,6 +26,8 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF S
|
||||
DAMAGE.
|
||||
*/
|
||||
|
||||
#undef ARRAY_DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <float.h>
|
||||
@@ -53,9 +55,9 @@ void ShowUsage( char* ex )
|
||||
{
|
||||
printf( "Usage: %s\n" , ex );
|
||||
printf( "\t --%s <input polygon mesh>\n" , In.name );
|
||||
printf( "\t[--%s <trimming value>]\n" , Trim.name );
|
||||
printf( "\t[--%s <ouput polygon mesh>]\n" , Out.name );
|
||||
printf( "\t[--%s <smoothing iterations>=%d]\n" , Smooth.name , Smooth.value );
|
||||
printf( "\t[--%s <trimming value>]\n" , Trim.name );
|
||||
printf( "\t[--%s <relative area of islands>=%f]\n" , IslandAreaRatio.name , IslandAreaRatio.value );
|
||||
printf( "\t[--%s]\n" , PolygonMesh.name );
|
||||
}
|
||||
@@ -100,7 +102,7 @@ void SplitPolygon
|
||||
std::vector< Vertex >& vertices ,
|
||||
std::vector< std::vector< int > >* ltPolygons , std::vector< std::vector< int > >* gtPolygons ,
|
||||
std::vector< bool >* ltFlags , std::vector< bool >* gtFlags ,
|
||||
hash_map< long long , int >& vertexTable ,
|
||||
std::unordered_map< long long, int >& vertexTable,
|
||||
Real trimValue
|
||||
)
|
||||
{
|
||||
@@ -127,7 +129,7 @@ void SplitPolygon
|
||||
int j1 = (start+int(sz)-1)%sz , j2 = start;
|
||||
int v1 = polygon[j1] , v2 = polygon[j2];
|
||||
int vIdx;
|
||||
hash_map< long long , int >::iterator iter = vertexTable.find( EdgeKey( v1 , v2 ) );
|
||||
std::unordered_map< long long, int >::iterator iter = vertexTable.find(EdgeKey(v1, v2));
|
||||
if( iter==vertexTable.end() )
|
||||
{
|
||||
vertexTable[ EdgeKey( v1 , v2 ) ] = vIdx = int( vertices.size() );
|
||||
@@ -145,7 +147,7 @@ void SplitPolygon
|
||||
else
|
||||
{
|
||||
int vIdx;
|
||||
hash_map< long long , int >::iterator iter = vertexTable.find( EdgeKey( v1 , v2 ) );
|
||||
std::unordered_map< long long, int >::iterator iter = vertexTable.find(EdgeKey(v1, v2));
|
||||
if( iter==vertexTable.end() )
|
||||
{
|
||||
vertexTable[ EdgeKey( v1 , v2 ) ] = vIdx = int( vertices.size() );
|
||||
@@ -204,7 +206,7 @@ double PolygonArea( const std::vector< Vertex >& vertices , const std::vector< i
|
||||
template< class Vertex >
|
||||
void RemoveHangingVertices( std::vector< Vertex >& vertices , std::vector< std::vector< int > >& polygons )
|
||||
{
|
||||
hash_map< int , int > vMap;
|
||||
std::unordered_map< int, int > vMap;
|
||||
std::vector< bool > vertexFlags( vertices.size() , false );
|
||||
for( size_t i=0 ; i<polygons.size() ; i++ ) for( size_t j=0 ; j<polygons[i].size() ; j++ ) vertexFlags[ polygons[i][j] ] = true;
|
||||
int vCount = 0;
|
||||
@@ -219,7 +221,7 @@ void SetConnectedComponents( const std::vector< std::vector< int > >& polygons ,
|
||||
{
|
||||
std::vector< int > polygonRoots( polygons.size() );
|
||||
for( size_t i=0 ; i<polygons.size() ; i++ ) polygonRoots[i] = int(i);
|
||||
hash_map< long long , int > edgeTable;
|
||||
std::unordered_map< long long, int > edgeTable;
|
||||
for( size_t i=0 ; i<polygons.size() ; i++ )
|
||||
{
|
||||
int sz = int( polygons[i].size() );
|
||||
@@ -228,7 +230,7 @@ void SetConnectedComponents( const std::vector< std::vector< int > >& polygons ,
|
||||
int j1 = j , j2 = (j+1)%sz;
|
||||
int v1 = polygons[i][j1] , v2 = polygons[i][j2];
|
||||
long long eKey = EdgeKey( v1 , v2 );
|
||||
hash_map< long long , int >::iterator iter = edgeTable.find( eKey );
|
||||
std::unordered_map< long long, int >::iterator iter = edgeTable.find(eKey);
|
||||
if( iter==edgeTable.end() ) edgeTable[ eKey ] = int(i);
|
||||
else
|
||||
{
|
||||
@@ -257,7 +259,7 @@ void SetConnectedComponents( const std::vector< std::vector< int > >& polygons ,
|
||||
}
|
||||
}
|
||||
int cCount = 0;
|
||||
hash_map< int , int > vMap;
|
||||
std::unordered_map< int , int > vMap;
|
||||
for( int i= 0 ; i<int(polygonRoots.size()) ; i++ ) if( polygonRoots[i]==i ) vMap[i] = cCount++;
|
||||
components.resize( cCount );
|
||||
for( int i=0 ; i<int(polygonRoots.size()) ; i++ ) components[ vMap[ polygonRoots[i] ] ].push_back(i);
|
||||
@@ -286,8 +288,7 @@ int Execute( void )
|
||||
for( size_t i=0 ; i<vertices.size() ; i++ ) min = std::min< float >( min , vertices[i].value ) , max = std::max< float >( max , vertices[i].value );
|
||||
printf( "Value Range: [%f,%f]\n" , min , max );
|
||||
|
||||
|
||||
hash_map< long long , int > vertexTable;
|
||||
std::unordered_map< long long, int > vertexTable;
|
||||
std::vector< std::vector< int > > ltPolygons , gtPolygons;
|
||||
std::vector< bool > ltFlags , gtFlags;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user