Commit 9e95fcc7 authored by Jan Möbius's avatar Jan Möbius
Browse files

Fixed various warnings and tried to fix mac build error

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free-Staging@16311 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 02d382e4
......@@ -134,13 +134,13 @@ void SortedTreeNodes::setCornerTable( CornerTableData& cData , const TreeOctNode
TreeOctNode* node = treeNodes[i];
if( d<maxDepth && node->children ) continue;
const TreeOctNode::ConstNeighbors3& neighbors = neighborKey.getNeighbors( node , minDepth );
for( int c=0 ; c<Cube::CORNERS ; c++ ) // Iterate over the cell's corners
for( unsigned int c=0 ; c<Cube::CORNERS ; c++ ) // Iterate over the cell's corners
{
bool cornerOwner = true;
int x , y , z;
int ac = Cube::AntipodalCornerIndex( c ); // The index of the node relative to the corner
Cube::FactorCornerIndex( c , x , y , z );
for( int cc=0 ; cc<Cube::CORNERS ; cc++ ) // Iterate over the corner's cells
for( unsigned int cc=0 ; cc<Cube::CORNERS ; cc++ ) // Iterate over the corner's cells
{
int xx , yy , zz;
Cube::FactorCornerIndex( cc , xx , yy , zz );
......@@ -167,7 +167,7 @@ void SortedTreeNodes::setCornerTable( CornerTableData& cData , const TreeOctNode
{
const TreeOctNode::ConstNeighbors3& neighbors = neighborKey.neighbors[d];
// Set all the corner indices at the current depth
for( int cc=0 ; cc<Cube::CORNERS ; cc++ )
for( unsigned int cc=0 ; cc<Cube::CORNERS ; cc++ )
{
int xx , yy , zz;
Cube::FactorCornerIndex( cc , xx , yy , zz );
......@@ -197,7 +197,7 @@ void SortedTreeNodes::setCornerTable( CornerTableData& cData , const TreeOctNode
{
int start = spans[d].first , end = spans[d].second , width = end - start;
for( int i=start + (width*t)/threads ; i<start+(width*(t+1))/threads ; i++ )
for( int c=0 ; c<Cube::CORNERS ; c++ )
for( unsigned int c=0 ; c<Cube::CORNERS ; c++ )
{
int& idx = cData[ treeNodes[i] ][c];
if( idx<0 )
......@@ -243,13 +243,13 @@ int SortedTreeNodes::getMaxCornerCount( int depth , int maxDepth , int threads )
if( d<maxDepth && node->children ) continue;
const TreeOctNode::ConstNeighbors3& neighbors = neighborKey.getNeighbors( node , depth );
for( int c=0 ; c<Cube::CORNERS ; c++ ) // Iterate over the cell's corners
for( unsigned int c=0 ; c<Cube::CORNERS ; c++ ) // Iterate over the cell's corners
{
bool cornerOwner = true;
int x , y , z;
int ac = Cube::AntipodalCornerIndex( c ); // The index of the node relative to the corner
Cube::FactorCornerIndex( c , x , y , z );
for( int cc=0 ; cc<Cube::CORNERS ; cc++ ) // Iterate over the corner's cells
for( unsigned int cc=0 ; cc<Cube::CORNERS ; cc++ ) // Iterate over the corner's cells
{
int xx , yy , zz;
Cube::FactorCornerIndex( cc , xx , yy , zz );
......@@ -285,7 +285,9 @@ void SortedTreeNodes::setEdgeTable( EdgeTableData& eData , const TreeOctNode* ro
int minDepth;
eData.offsets.resize( this->maxDepth , -1 );
int start , end;
int start = 0;
int end = 0;
if( rootNode ) minDepth = rootNode->depth() , start = end = rootNode->nodeData.nodeIndex;
else
{
......@@ -327,13 +329,13 @@ void SortedTreeNodes::setEdgeTable( EdgeTableData& eData , const TreeOctNode* ro
TreeOctNode* node = treeNodes[i];
const TreeOctNode::ConstNeighbors3& neighbors = neighborKey.getNeighbors( node , minDepth );
for( int e=0 ; e<Cube::EDGES ; e++ )
for( unsigned int e=0 ; e<Cube::EDGES ; e++ )
{
bool edgeOwner = true;
int o , i , j;
Cube::FactorEdgeIndex( e , o , i , j );
int ac = Square::AntipodalCornerIndex( Square::CornerIndex( i , j ) );
for( int cc=0 ; cc<Square::CORNERS ; cc++ )
for( unsigned int cc=0 ; cc<Square::CORNERS ; cc++ )
{
int ii , jj , x , y , z;
Square::FactorCornerIndex( cc , ii , jj );
......@@ -349,9 +351,16 @@ void SortedTreeNodes::setEdgeTable( EdgeTableData& eData , const TreeOctNode* ro
if( edgeOwner )
{
// Set all edge indices
for( int cc=0 ; cc<Square::CORNERS ; cc++ )
for( unsigned int cc=0 ; cc<Square::CORNERS ; cc++ )
{
int ii , jj , aii , ajj , x , y , z;
int ii = 0;
int jj = 0;
int aii = 0;
int ajj = 0;
int x = 0;
int y = 0;
int z = 0;
Square::FactorCornerIndex( cc , ii , jj );
Square::FactorCornerIndex( Square::AntipodalCornerIndex( cc ) , aii , ajj );
ii += i , jj += j;
......@@ -380,7 +389,7 @@ void SortedTreeNodes::setEdgeTable( EdgeTableData& eData , const TreeOctNode* ro
{
int start = spans[d].first , end = spans[d].second , width = end - start;
for( int i=start + (width*t)/threads ; i<start+(width*(t+1))/threads ; i++ )
for( int e=0 ; e<Cube::EDGES ; e++ )
for( unsigned int e=0 ; e<Cube::EDGES ; e++ )
{
int& idx = eData[ treeNodes[i] ][e];
if( idx<0 ) fprintf( stderr , "[ERROR] Found unindexed edge %d (%d,%d)\n" , idx , minDepth , maxDepth ) , exit( 0 );
......@@ -414,15 +423,20 @@ int SortedTreeNodes::getMaxEdgeCount( const TreeOctNode* rootNode , int depth ,
int d , off[3];
node->depthAndOffset( d , off );
for( int e=0 ; e<Cube::EDGES ; e++ )
for( unsigned int e=0 ; e<Cube::EDGES ; e++ )
{
bool edgeOwner = true;
int o , i , j;
Cube::FactorEdgeIndex( e , o , i , j );
int ac = Square::AntipodalCornerIndex( Square::CornerIndex( i , j ) );
for( int cc=0 ; cc<Square::CORNERS ; cc++ )
for( unsigned int cc=0 ; cc<Square::CORNERS ; cc++ )
{
int ii , jj , x , y , z;
int ii = 0;
int jj = 0;
int x = 0;
int y = 0;
int z = 0;
Square::FactorCornerIndex( cc , ii , jj );
ii += i , jj += j;
switch( o )
......@@ -1110,7 +1124,8 @@ int Octree<Degree>::setTreeMemory( std::vector< Real >& _pts_stream, int maxDept
double pointWeightSum = 0;
Point3D< Real > min , max , myCenter;
Real myWidth;
int i , cnt=0;
int i;
unsigned int cnt=0;
TreeOctNode* temp;
TreeOctNode::NeighborKey3 neighborKey;
......@@ -2556,7 +2571,7 @@ int Octree<Degree>::HasNormals(TreeOctNode* node,Real epsilon)
{
int hasNormals=0;
if( node->nodeData.normalIndex>=0 && ( (*normals)[node->nodeData.normalIndex][0]!=0 || (*normals)[node->nodeData.normalIndex][1]!=0 || (*normals)[node->nodeData.normalIndex][2]!=0 ) ) hasNormals=1;
if( node->children ) for(int i=0;i<Cube::CORNERS && !hasNormals;i++) hasNormals |= HasNormals(&node->children[i],epsilon);
if( node->children ) for(unsigned int i=0;i<Cube::CORNERS && !hasNormals;i++) hasNormals |= HasNormals(&node->children[i],epsilon);
return hasNormals;
}
......@@ -2568,7 +2583,7 @@ void Octree<Degree>::ClipTree( void )
if( temp->children && temp->d>=_minDepth )
{
int hasNormals=0;
for( int i=0 ; i<Cube::CORNERS && !hasNormals ; i++ ) hasNormals = HasNormals( &temp->children[i] , EPSILON/(1<<maxDepth) );
for( unsigned int i=0 ; i<Cube::CORNERS && !hasNormals ; i++ ) hasNormals = HasNormals( &temp->children[i] , EPSILON/(1<<maxDepth) );
if( !hasNormals ) temp->children=NULL;
}
MemoryUsage();
......@@ -3441,7 +3456,9 @@ int Octree<Degree>::IsBoundaryEdge(const TreeOctNode* node,int edgeIndex,int sub
template<int Degree>
int Octree<Degree>::IsBoundaryEdge( const TreeOctNode* node , int dir , int x , int y , int subdivideDepth )
{
int d , o[3] , idx1 , idx2 , mask;
int d , o[3];
int idx1 = 0;
int idx2 = 0;
if( subdivideDepth<0 ) return 0;
if( node->d<=subdivideDepth ) return 1;
......@@ -3462,7 +3479,7 @@ int Octree<Degree>::IsBoundaryEdge( const TreeOctNode* node , int dir , int x ,
idx2 = o[1] + y;
break;
}
mask = 1<<( int(node->d) - subdivideDepth );
int mask = 1<<( int(node->d) - subdivideDepth );
return !(idx1%(mask)) || !(idx2%(mask));
}
template< int Degree >
......
......@@ -168,8 +168,9 @@ template <class NodeData,class Real>
int OctNode<NodeData,Real>::maxDepth(void) const{
if(!children){return 0;}
else{
int c,d;
for(int i=0;i<Cube::CORNERS;i++){
int c=0;
int d=0;
for(unsigned int i=0;i<Cube::CORNERS;i++){
d=children[i].maxDepth();
if(!i || d>c){c=d;}
}
......@@ -181,7 +182,7 @@ int OctNode<NodeData,Real>::nodes(void) const{
if(!children){return 1;}
else{
int c=0;
for(int i=0;i<Cube::CORNERS;i++){c+=children[i].nodes();}
for(unsigned int i=0;i<Cube::CORNERS;i++){c+=children[i].nodes();}
return c+1;
}
}
......@@ -190,7 +191,7 @@ int OctNode<NodeData,Real>::leaves(void) const{
if(!children){return 1;}
else{
int c=0;
for(int i=0;i<Cube::CORNERS;i++){c+=children[i].leaves();}
for(unsigned int i=0;i<Cube::CORNERS;i++){c+=children[i].leaves();}
return c;
}
}
......@@ -200,7 +201,7 @@ int OctNode<NodeData,Real>::maxDepthLeaves(int maxDepth) const{
if(!children){return 1;}
else{
int c=0;
for(int i=0;i<Cube::CORNERS;i++){c+=children[i].maxDepthLeaves(maxDepth);}
for(unsigned int i=0;i<Cube::CORNERS;i++){c+=children[i].maxDepthLeaves(maxDepth);}
return c;
}
}
......@@ -700,7 +701,7 @@ const OctNode<NodeData,Real>* OctNode<NodeData,Real>::getNearestLeaf(const Point
int nearest;
Real temp,dist2;
if(!children){return this;}
for(int i=0;i<Cube::CORNERS;i++){
for(unsigned int i=0;i<Cube::CORNERS;i++){
temp=SquareDistance(children[i].center,p);
if(!i || temp<dist2){
dist2=temp;
......@@ -759,7 +760,7 @@ OctNode<NodeData,Real>& OctNode<NodeData,Real>::operator = (const OctNode<NodeDa
if(children){delete[] children;}
children=NULL;
depth=node.depth;
this->depth=node.depth;
for(i=0;i<DIMENSION;i++){this->offset[i] = node.offset[i];}
if(node.children){
initChildren();
......@@ -1862,7 +1863,7 @@ int OctNode<NodeData,Real>::write(const char* fileName) const{
template <class NodeData,class Real>
int OctNode<NodeData,Real>::write(FILE* fp) const{
fwrite(this,sizeof(OctNode<NodeData,Real>),1,fp);
if(children){for(int i=0;i<Cube::CORNERS;i++){children[i].write(fp);}}
if(children){for(unsigned int i=0;i<Cube::CORNERS;i++){children[i].write(fp);}}
return 1;
}
template <class NodeData,class Real>
......@@ -1880,7 +1881,7 @@ int OctNode<NodeData,Real>::read(FILE* fp){
if(children){
children=NULL;
initChildren();
for(int i=0;i<Cube::CORNERS;i++){
for(unsigned int i=0;i<Cube::CORNERS;i++){
children[i].read(fp);
children[i].parent=this;
}
......
......@@ -16,14 +16,15 @@
//== INCLUDES =================================================================
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#ifdef _WIN32
#include <Windows.h>
#include <Psapi.h>
#endif // _WIN32
#ifdef USE_OPENMP
#include "omp.h"
#endif
#include "PoissonReconstruction/Time.h"
#include "PoissonReconstruction/MarchingCubes.h"
#include "PoissonReconstruction/Octree.h"
......@@ -32,9 +33,7 @@
#include "PoissonReconstruction/PPolynomial.h"
#include "PoissonReconstruction/ply.h"
#include "PoissonReconstruction/MemoryUsage.h"
#include "omp.h"
#include "PoissonReconstruction/MultiGridOctreeData.h"
#include <stdarg.h>
//== FORWARDDECLARATIONS ======================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment