Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 31 additions & 35 deletions Src/PoissonRecon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cmdLineParameter< char* >
Grid( "grid" ) ,
Tree( "tree" ) ,
Envelope( "envelope" ) ,
EnvelopeGrid( "envelopeGrid" ),
EnvelopeGrid( "envelopeGrid" ) ,
Transform( "xForm" );

cmdLineReadable
Expand Down Expand Up @@ -174,6 +174,7 @@ void ShowUsage(char* ex)
printf( "\t[--%s <ouput grid>]\n" , Grid.name );
printf( "\t[--%s <output envelope grid>\n" , EnvelopeGrid.name );
printf( "\t[--%s <ouput fem tree>]\n" , Tree.name );
printf( "\t[--%s <input transform file containing space separated %dx%d matrix>]\n" , Transform.name , DEFAULT_DIMENSION , DEFAULT_DIMENSION );
#ifndef FAST_COMPILE
printf( "\t[--%s <b-spline degree>=%d]\n" , Degree.name , Degree.value );
printf( "\t[--%s <boundary type>=%d]\n" , BType.name , BType.value );
Expand Down Expand Up @@ -267,30 +268,26 @@ template< class Real , unsigned int Dim >
XForm< Real , Dim+1 > GetBoundingBoxXForm( Point< Real , Dim > min , Point< Real , Dim > max , Real scaleFactor )
{
Point< Real , Dim > center = ( max + min ) / 2;
Real scale = max[0] - min[0];
for( int d=1 ; d<Dim ; d++ ) scale = std::max< Real >( scale , max[d]-min[d] );
scale *= scaleFactor;
for( int i=0 ; i<Dim ; i++ ) center[i] -= scale/2;
Real max_range = max[0] - min[0];
for( int d=1 ; d<Dim ; d++ ) max_range = std::max< Real >( max_range , max[d]-min[d] );
max_range *= scaleFactor;
for( int i=0 ; i<Dim ; i++ ) center[i] -= max_range/2;
XForm< Real , Dim+1 > tXForm = XForm< Real , Dim+1 >::Identity() , sXForm = XForm< Real , Dim+1 >::Identity();
for( int i=0 ; i<Dim ; i++ ) sXForm(i,i) = (Real)(1./scale ) , tXForm(Dim,i) = -center[i];
for( int i=0 ; i<Dim ; i++ ) sXForm(i,i) = (Real)(1./max_range ) , tXForm(Dim,i) = -center[i];
return sXForm * tXForm;
}
template< class Real , unsigned int Dim >
XForm< Real , Dim+1 > GetBoundingBoxXForm( Point< Real , Dim > min , Point< Real , Dim > max , Real width , Real scaleFactor , int& depth )
{
// Get the target resolution (along the largest dimension)
Real resolution = ( max[0]-min[0] ) / width;
for( int d=1 ; d<Dim ; d++ ) resolution = std::max< Real >( resolution , ( max[d]-min[d] ) / width );
resolution *= scaleFactor;
depth = 0;
while( (1<<depth)<resolution ) depth++;

Point< Real , Dim > center = ( max + min ) / 2;
Real scale = (1<<depth) * width;

for( int i=0 ; i<Dim ; i++ ) center[i] -= scale/2;
Real max_range = max[0] - min[0];
for( int d=1 ; d<Dim ; d++ ) max_range = std::max< Real >( max_range , max[d]-min[d] );
max_range *= scaleFactor;
Real fine_voxels = ceil(max_range / width);
for ( depth=0 ; (1 << depth) < fine_voxels; ++depth);
for( int i=0 ; i<Dim ; i++ ) center[i] -= max_range/2;
XForm< Real , Dim+1 > tXForm = XForm< Real , Dim+1 >::Identity() , sXForm = XForm< Real , Dim+1 >::Identity();
for( int i=0 ; i<Dim ; i++ ) sXForm(i,i) = (Real)(1./scale ) , tXForm(Dim,i) = -center[i];
for( int i=0 ; i<Dim ; i++ ) sXForm(i,i) = (Real)(1./max_range ) , tXForm(Dim,i) = -center[i];
return sXForm * tXForm;
}

Expand Down Expand Up @@ -611,6 +608,23 @@ void Execute( UIntPack< FEMSigs ... > , const AuxDataFactory &auxDataFactory )
if( Width.value>0 ) modelToUnitCube = GetPointXForm< Real , Dim , typename AuxDataFactory::VertexType >( _pointStream , Width.value , (Real)( Scale.value>0 ? Scale.value : 1. ) , Depth.value ) * modelToUnitCube;
else modelToUnitCube = Scale.value>0 ? GetPointXForm< Real , Dim , typename AuxDataFactory::VertexType >( _pointStream , (Real)Scale.value ) * modelToUnitCube : modelToUnitCube;

if( !KernelDepth.set ) KernelDepth.value = Depth.value-2;
if( KernelDepth.value>Depth.value )
{
WARN( "Kernel depth should not exceed depth: " , KernelDepth.name , " <= " , KernelDepth.value );
KernelDepth.value = Depth.value;
}
if( !EnvelopeDepth.set ) EnvelopeDepth.value = BaseDepth.value;
if( EnvelopeDepth.value>Depth.value )
{
WARN( EnvelopeDepth.name , " can't be greater than " , Depth.name , ": " , EnvelopeDepth.value , " <= " , Depth.value );
EnvelopeDepth.value = Depth.value;
}
if( EnvelopeDepth.value<BaseDepth.value )
{
WARN( EnvelopeDepth.name , " can't be less than " , BaseDepth.name , ": " , EnvelopeDepth.value , " >= " , BaseDepth.value );
EnvelopeDepth.value = BaseDepth.value;
}
if( !SolveDepth.set ) SolveDepth.value = Depth.value;
if( SolveDepth.value>Depth.value )
{
Expand Down Expand Up @@ -1078,24 +1092,6 @@ int main( int argc , char* argv[] )
if( BaseDepth.set ) WARN( "Base depth must be smaller than full depth: " , BaseDepth.value , " <= " , FullDepth.value );
BaseDepth.value = FullDepth.value;
}
if( !KernelDepth.set ) KernelDepth.value = Depth.value-2;
if( KernelDepth.value>Depth.value )
{
WARN( "Kernel depth should not exceed depth: " , KernelDepth.name , " <= " , KernelDepth.value );
KernelDepth.value = Depth.value;
}

if( !EnvelopeDepth.set ) EnvelopeDepth.value = BaseDepth.value;
if( EnvelopeDepth.value>Depth.value )
{
WARN( EnvelopeDepth.name , " can't be greater than " , Depth.name , ": " , EnvelopeDepth.value , " <= " , Depth.value );
EnvelopeDepth.value = Depth.value;
}
if( EnvelopeDepth.value<BaseDepth.value )
{
WARN( EnvelopeDepth.name , " can't be less than " , BaseDepth.name , ": " , EnvelopeDepth.value , " >= " , BaseDepth.value );
EnvelopeDepth.value = BaseDepth.value;
}

#ifdef USE_DOUBLE
typedef double Real;
Expand Down
18 changes: 12 additions & 6 deletions Src/VertexFactory.inl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ namespace VertexFactory
{
switch( plyType )
{
case PLY_INT: return TypeOnDisk::INT;
case PLY_UINT: return TypeOnDisk::UINT;
case PLY_CHAR: return TypeOnDisk::CHAR;
case PLY_UCHAR: return TypeOnDisk::UCHAR;
case PLY_FLOAT: return TypeOnDisk::FLOAT;
case PLY_DOUBLE: return TypeOnDisk::DOUBLE;
case PLY_INT: return TypeOnDisk::INT;
case PLY_UINT: return TypeOnDisk::UINT;
case PLY_CHAR: return TypeOnDisk::CHAR;
case PLY_UCHAR: return TypeOnDisk::UCHAR;
case PLY_FLOAT: return TypeOnDisk::FLOAT;
case PLY_DOUBLE: return TypeOnDisk::DOUBLE;
case PLY_INT_8: return TypeOnDisk::CHAR;
case PLY_UINT_8: return TypeOnDisk::UCHAR;
case PLY_INT_32: return TypeOnDisk::INT;
case PLY_UINT_32: return TypeOnDisk::UINT;
case PLY_FLOAT_32: return TypeOnDisk::FLOAT;
case PLY_FLOAT_64: return TypeOnDisk::DOUBLE;
default: ERROR_OUT( "Unrecognized type: " , plyType );
}
return TypeOnDisk::UNKNOWN;
Expand Down