Reimplemented SelfIntersection
This commit is contained in:
parent
c334cebb47
commit
94853880bb
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.22 2005/12/16 10:54:59 corsini
|
||||||
|
Reimplement isOrientedMesh
|
||||||
|
|
||||||
Revision 1.21 2005/12/16 10:53:39 corsini
|
Revision 1.21 2005/12/16 10:53:39 corsini
|
||||||
Take account for deletion in isComplexManifold
|
Take account for deletion in isComplexManifold
|
||||||
|
|
||||||
|
@ -633,58 +636,46 @@ namespace vcg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool SelfIntersections(MeshType &m)
|
static bool SelfIntersections(MeshType &m, std::vector<FaceType*> &ret)
|
||||||
{
|
{
|
||||||
|
assert(FaceType::HasMark()); // Needed by the UG
|
||||||
|
|
||||||
Box3< ScalarType> bbox;
|
Box3< ScalarType> bbox;
|
||||||
TriMeshGrid gM;
|
TriMeshGrid gM;
|
||||||
|
ret.clear();
|
||||||
int nelem;
|
|
||||||
|
|
||||||
double bdiag = m.bbox.Diag();
|
|
||||||
|
|
||||||
bbox.SetNull();
|
|
||||||
FaceType *f=0;
|
|
||||||
Point3x normf, bestq, ip,p;
|
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
|
int referredBit = FaceType::NewBitFlag();
|
||||||
|
|
||||||
|
int deleted = 0;
|
||||||
|
|
||||||
|
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
|
(*fi).ClearUserBit(referredBit);
|
||||||
|
|
||||||
|
|
||||||
std::vector<FaceType*> ret;
|
|
||||||
std::vector<FaceType*> inBox;
|
std::vector<FaceType*> inBox;
|
||||||
gM.Set(m.face.begin(),m.face.end());
|
gM.Set(m.face.begin(),m.face.end());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
{
|
{
|
||||||
|
(*fi).SetUserBit(referredBit);
|
||||||
|
|
||||||
(*fi).GetBBox(bbox);
|
(*fi).GetBBox(bbox);
|
||||||
vcg::trimesh::GetInBoxFace(m, gM, bbox,inBox);
|
vcg::trimesh::GetInBoxFace(m, gM, bbox,inBox);
|
||||||
|
bool Intersected=false;
|
||||||
// fill the cell
|
std::vector<FaceType*>::iterator fib;
|
||||||
/*....*/
|
for(fib=inBox.begin();fib!=inBox.end();++fib)
|
||||||
|
{
|
||||||
|
if(!(*fib)->IsUserBit(referredBit) && (*fib != &*fi) )
|
||||||
nelem = inBox.size();
|
if(TestIntersection(&*fi,*fib)){
|
||||||
|
ret.push_back(*fib);
|
||||||
|
if(!Intersected) {
|
||||||
if (nelem>=2)// in a cell
|
ret.push_back(&*fi);
|
||||||
{
|
Intersected=true;
|
||||||
//test combinations of elements
|
}
|
||||||
for (int i=0;i<nelem-1;i++)
|
}
|
||||||
for (int j=i+1;j<nelem;j++)
|
}
|
||||||
if ((!inBox[i]->IsD())&&(!inBox[j]->IsD())&&(TestIntersection(inBox[i],inBox[j])))
|
|
||||||
{
|
|
||||||
|
|
||||||
ret.push_back(inBox[i]);
|
|
||||||
ret.push_back(inBox[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inBox.clear();
|
inBox.clear();
|
||||||
bbox.SetNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FaceType::DeleteBitFlag(referredBit);
|
||||||
return (ret.size()>0);
|
return (ret.size()>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue