removed mostly harmless gcc warnings (unused/uninitialized vars)

This commit is contained in:
Paolo Cignoni 2010-07-14 08:00:16 +00:00
parent b543ff311e
commit 882d039da6
3 changed files with 12 additions and 19 deletions

View File

@ -342,24 +342,13 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
Begin(); Begin();
extractor.Initialize(); extractor.Initialize();
int computeTime =0; for (int j=0; j<=this->siz.Y(); j++)
int extractTime =0;
int t0,t1,t2;
for (int j=0; j<=this->siz.Y(); j++)
{ {
cb((100*j)/this->siz.Y(),"Marching "); cb((100*j)/this->siz.Y(),"Marching ");
t0 = clock();
ProcessSlice<EXTRACTOR_TYPE>(extractor);//find cells where there is the isosurface and examine it ProcessSlice<EXTRACTOR_TYPE>(extractor);//find cells where there is the isosurface and examine it
t1 = clock(); NextSlice();
NextSlice();
t2 = clock();
computeTime += t1-t0;
extractTime += t2-t1;
} }
extractor.Finalize(); extractor.Finalize();
#ifndef NO_QT
qDebug("Extract %i, Compute %i",t1-t0,t2-t1);
#endif
typename New_Mesh::VertexIterator vi; typename New_Mesh::VertexIterator vi;
for(vi=new_mesh.vert.begin();vi!=new_mesh.vert.end();++vi) for(vi=new_mesh.vert.begin();vi!=new_mesh.vert.end();++vi)
if(!(*vi).IsD()) if(!(*vi).IsD())
@ -515,7 +504,7 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
int i = p1.X();// (p1.X() - _bbox.min.X())/_cell_size.X(); int i = p1.X();// (p1.X() - _bbox.min.X())/_cell_size.X();
int z = p1.Z();//(p1.Z() - _bbox.min.Z())/_cell_size.Z(); int z = p1.Z();//(p1.Z() - _bbox.min.Z())/_cell_size.Z();
VertexIndex index = i+z*this->siz.X(); VertexIndex index = i+z*this->siz.X();
VertexIndex pos; VertexIndex pos=-1;
if (p1.Y()==CurrentSlice) if (p1.Y()==CurrentSlice)
{ {
if ((pos=_x_cs[index])==-1) if ((pos=_x_cs[index])==-1)
@ -540,6 +529,7 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
return; return;
} }
} }
assert(pos>=0);
v = &_newM->vert[pos]; v = &_newM->vert[pos];
} }
@ -553,7 +543,7 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
int i = p1.X(); // (p1.X() - _bbox.min.X())/_cell_size.X(); int i = p1.X(); // (p1.X() - _bbox.min.X())/_cell_size.X();
int z = p1.Z(); // (p1.Z() - _bbox.min.Z())/_cell_size.Z(); int z = p1.Z(); // (p1.Z() - _bbox.min.Z())/_cell_size.Z();
VertexIndex index = i+z*this->siz.X(); VertexIndex index = i+z*this->siz.X();
VertexIndex pos; VertexIndex pos=-1;
if ((pos=_y_cs[index])==-1) if ((pos=_y_cs[index])==-1)
{ {
_y_cs[index] = (VertexIndex) _newM->vert.size(); _y_cs[index] = (VertexIndex) _newM->vert.size();
@ -562,7 +552,8 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
v = &_newM->vert[ pos ]; v = &_newM->vert[ pos ];
v->P()=Interpolate(p1,p2,1); v->P()=Interpolate(p1,p2,1);
} }
v = &_newM->vert[pos]; assert(pos>=0);
v = &_newM->vert[pos];
} }
///if there is a vertex in z axis of a cell return the vertex or create it ///if there is a vertex in z axis of a cell return the vertex or create it
@ -576,7 +567,7 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
int z = p1.Z(); //(p1.Z() - _bbox.min.Z())/_cell_size.Z(); int z = p1.Z(); //(p1.Z() - _bbox.min.Z())/_cell_size.Z();
VertexIndex index = i+z*this->siz.X(); VertexIndex index = i+z*this->siz.X();
VertexIndex pos; VertexIndex pos=-1;
if (p1.Y()==CurrentSlice) if (p1.Y()==CurrentSlice)
{ {
if ((pos=_z_cs[index])==-1) if ((pos=_z_cs[index])==-1)
@ -601,6 +592,7 @@ template <class OLD_MESH_TYPE,class NEW_MESH_TYPE, class FLT, class DISTFUNCTOR
return; return;
} }
} }
assert(pos>=0);
v = &_newM->vert[pos]; v = &_newM->vert[pos];
} }

View File

@ -183,7 +183,7 @@ class Geo{
std::vector<VertDist> frontier; std::vector<VertDist> frontier;
VertexIterator ii; VertexIterator ii;
std::list<VertexPointer> children; std::list<VertexPointer> children;
VertexPointer curr,farthest,pw1; VertexPointer curr,farthest=0,pw1;
typename std::list<VertexPointer>::iterator is; typename std::list<VertexPointer>::iterator is;
std::deque<VertexPointer> leaves; std::deque<VertexPointer> leaves;
std::vector<VertDist> _frontier; std::vector<VertDist> _frontier;
@ -287,6 +287,7 @@ class Geo{
(*vi).Q() = (*TD)[&(*vi)].d; (*vi).Q() = (*TD)[&(*vi)].d;
delete TD; delete TD;
assert(farthest);
return farthest; return farthest;
} }

View File

@ -176,7 +176,7 @@ inline bool SegmentSegmentIntersection(const vcg::Segment2<SCALAR_TYPE> &seg0,
vcg::Point2<SCALAR_TYPE> dir1=seg1.P1()-seg1.P0(); vcg::Point2<SCALAR_TYPE> dir1=seg1.P1()-seg1.P0();
dir1.Normalize(); dir1.Normalize();
l1.SetDirection(dir1); l1.SetDirection(dir1);
bool b=LineLineIntersection(l0,l1,p_inters); LineLineIntersection(l0,l1,p_inters);
SCALAR_TYPE len0=seg0.Length(); SCALAR_TYPE len0=seg0.Length();
SCALAR_TYPE len1=seg1.Length(); SCALAR_TYPE len1=seg1.Length();
SCALAR_TYPE d0=(seg0.P0()-p_inters).Norm(); SCALAR_TYPE d0=(seg0.P0()-p_inters).Norm();