本文整理汇总了C++中Octree::GetSolutionGrid方法的典型用法代码示例。如果您正苦于以下问题:C++ Octree::GetSolutionGrid方法的具体用法?C++ Octree::GetSolutionGrid怎么用?C++ Octree::GetSolutionGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octree
的用法示例。
在下文中一共展示了Octree::GetSolutionGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PoissonRecon
//.........这里部分代码省略.........
DumpOutput( "Input Points: %d\n" , pointCount );
DumpOutput( "Leaves/Nodes: %d/%d\n" , tree.tree.leaves() , tree.tree.nodes() );
DumpOutput( "Memory Usage: %.3f MB\n" , float( MemoryInfo::Usage() )/(1<<20) );*/
maxMemoryUsage = tree.maxMemoryUsage;
t=Time() , tree.maxMemoryUsage=0;
tree.SetLaplacianConstraints();
/*DumpOutput2( comments[commentNum++] , "# Constraints set in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
DumpOutput( "Memory Usage: %.3f MB\n" , float( MemoryInfo::Usage())/(1<<20) );*/
maxMemoryUsage = std::max< double >( maxMemoryUsage , tree.maxMemoryUsage );
t=Time() , tree.maxMemoryUsage=0;
tree.LaplacianMatrixIteration( SolverDivide.value, ShowResidual.set , MinIters.value , SolverAccuracy.value , MaxSolveDepth.value , FixedIters.value );
/*DumpOutput2( comments[commentNum++] , "# Linear system solved in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
DumpOutput( "Memory Usage: %.3f MB\n" , float( MemoryInfo::Usage() )/(1<<20) );*/
maxMemoryUsage = std::max< double >( maxMemoryUsage , tree.maxMemoryUsage );
CoredFileMeshData< PlyValueVertex< Real > > mesh;
if( Verbose.set ) tree.maxMemoryUsage=0;
t=Time();
isoValue = tree.GetIsoValue();
//DumpOutput( "Got average in: %f\n" , Time()-t );
//DumpOutput( "Iso-Value: %e\n" , isoValue );
if( VoxelGrid.set )
{
double t = Time();
FILE* fp = fopen( VoxelGrid.value , "wb" );
if( !fp ) fprintf( stderr , "Failed to open voxel file for writing: %s\n" , VoxelGrid.value );
else
{
int res;
Pointer( Real ) values = tree.GetSolutionGrid( res , isoValue , VoxelDepth.value );
fwrite( &res , sizeof(int) , 1 , fp );
if( sizeof(Real)==sizeof(float) ) fwrite( values , sizeof(float) , res*res*res , fp );
else
{
float *fValues = new float[res*res*res];
for( int i=0 ; i<res*res*res ; i++ ) fValues[i] = float( values[i] );
fwrite( fValues , sizeof(float) , res*res*res , fp );
delete[] fValues;
}
fclose( fp );
DeletePointer( values );
}
//DumpOutput( "Got voxel grid in: %f\n" , Time()-t );
}
if( Out.set )
{
t = Time() , tree.maxMemoryUsage = 0;
tree.GetMCIsoTriangles( isoValue , IsoDivide.value , &mesh , 0 , 1 , !NonManifold.set , PolygonMesh.set );
//if( PolygonMesh.set ) DumpOutput2( comments[commentNum++] , "# Got polygons in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
//else DumpOutput2( comments[commentNum++] , "# Got triangles in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
maxMemoryUsage = std::max< double >( maxMemoryUsage , tree.maxMemoryUsage );
//DumpOutput2( comments[commentNum++],"# Total Solve: %9.1f (s), %9.1f (MB)\n" , Time()-tt , maxMemoryUsage );
//if( NoComments.set )
//{
// if( ASCII.set ) PlyWritePolygons( Out.value , &mesh , PLY_ASCII , NULL , 0 , iXForm );
// else PlyWritePolygons( Out.value , &mesh , PLY_BINARY_NATIVE , NULL , 0 , iXForm );
//}
//else
//{
// if( ASCII.set ) PlyWritePolygons( Out.value , &mesh , PLY_ASCII , comments , commentNum , iXForm );
示例2: ExecuteMemory
//.........这里部分代码省略.........
t=Time();
int kernelDepth = KernelDepth.set ? KernelDepth.value : Depth.value-2;
tree.setBSplineData( Depth.value , BoundaryType.value );
if( kernelDepth>Depth.value )
{
fprintf( stderr,"[ERROR] %s can't be greater than %s: %d <= %d\n" , KernelDepth.name , Depth.name , KernelDepth.value , Depth.value );
return EXIT_FAILURE;
}
double maxMemoryUsage;
t=Time() , tree.maxMemoryUsage=0;
//int pointCount = tree.setTree( In.value , Depth.value , MinDepth.value , kernelDepth , Real(SamplesPerNode.value) , Scale.value , Confidence.set , PointWeight.value , AdaptiveExponent.value , xForm );
// Load data
MemoryPointStream< Real >* ps = new MemoryPointStream< Real >( &positions, &normals );
int pointCount = tree.setTreeMemory( ps , Depth.value , MinDepth.value , kernelDepth , Real(SamplesPerNode.value) , Scale.value , Confidence.set , PointWeight.value , AdaptiveExponent.value , xForm );
tree.ClipTree();
tree.finalize( IsoDivide.value );
DumpOutput2( comments[commentNum++] , "# Tree set in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
DumpOutput( "Input Points: %d\n" , pointCount );
DumpOutput( "Leaves/Nodes: %d/%d\n" , tree.tree.leaves() , tree.tree.nodes() );
DumpOutput( "Memory Usage: %.3f MB\n" , float( MemoryInfo::Usage() )/(1<<20) );
maxMemoryUsage = tree.maxMemoryUsage;
t=Time() , tree.maxMemoryUsage=0;
tree.SetLaplacianConstraints();
DumpOutput2( comments[commentNum++] , "# Constraints set in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
DumpOutput( "Memory Usage: %.3f MB\n" , float( MemoryInfo::Usage())/(1<<20) );
maxMemoryUsage = std::max< double >( maxMemoryUsage , tree.maxMemoryUsage );
t=Time() , tree.maxMemoryUsage=0;
tree.LaplacianMatrixIteration( SolverDivide.value, ShowResidual.set , MinIters.value , SolverAccuracy.value , MaxSolveDepth.value , FixedIters.value );
DumpOutput2( comments[commentNum++] , "# Linear system solved in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
DumpOutput( "Memory Usage: %.3f MB\n" , float( MemoryInfo::Usage() )/(1<<20) );
maxMemoryUsage = std::max< double >( maxMemoryUsage , tree.maxMemoryUsage );
CoredFileMeshData< Vertex > mesh;
if( Verbose.set ) tree.maxMemoryUsage=0;
t=Time();
isoValue = tree.GetIsoValue();
DumpOutput( "Got average in: %f\n" , Time()-t );
DumpOutput( "Iso-Value: %e\n" , isoValue );
if( VoxelGrid.set )
{
double t = Time();
FILE* fp = fopen( VoxelGrid.value , "wb" );
if( !fp ) fprintf( stderr , "Failed to open voxel file for writing: %s\n" , VoxelGrid.value );
else
{
int res;
Pointer( Real ) values = tree.GetSolutionGrid( res , isoValue , VoxelDepth.value );
fwrite( &res , sizeof(int) , 1 , fp );
if( sizeof(Real)==sizeof(float) ) fwrite( values , sizeof(float) , res*res*res , fp );
else
{
float *fValues = new float[res*res*res];
for( int i=0 ; i<res*res*res ; i++ ) fValues[i] = float( values[i] );
fwrite( fValues , sizeof(float) , res*res*res , fp );
delete[] fValues;
}
fclose( fp );
DeletePointer( values );
}
DumpOutput( "Got voxel grid in: %f\n" , Time()-t );
}
if( Out.set )
{
t = Time() , tree.maxMemoryUsage = 0;
tree.GetMCIsoTriangles( isoValue , IsoDivide.value , &mesh , 0 , 1 , !NonManifold.set , PolygonMesh.set );
if( PolygonMesh.set ) DumpOutput2( comments[commentNum++] , "# Got polygons in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
else DumpOutput2( comments[commentNum++] , "# Got triangles in: %9.1f (s), %9.1f (MB)\n" , Time()-t , tree.maxMemoryUsage );
maxMemoryUsage = std::max< double >( maxMemoryUsage , tree.maxMemoryUsage );
DumpOutput2( comments[commentNum++],"# Total Solve: %9.1f (s), %9.1f (MB)\n" , Time()-tt , maxMemoryUsage );
/*
if( NoComments.set )
{
if( ASCII.set ) PlyWritePolygons( Out.value , &mesh , PLY_ASCII , NULL , 0 , iXForm );
else PlyWritePolygons( Out.value , &mesh , PLY_BINARY_NATIVE , NULL , 0 , iXForm );
}
else
{
if( ASCII.set ) PlyWritePolygons( Out.value , &mesh , PLY_ASCII , comments , commentNum , iXForm );
else PlyWritePolygons( Out.value , &mesh , PLY_BINARY_NATIVE , comments , commentNum , iXForm );
}*/
// Write to memory
writeTriMesh(&mesh, vertices, faces);
}
return 1;
}