updated with new spatial hashing version

This commit is contained in:
Nico Pietroni 2005-06-15 10:09:41 +00:00
parent ccbfc728cb
commit b855e951d7
2 changed files with 30 additions and 23 deletions

View File

@ -77,6 +77,7 @@ public:
{ {
HTable->Clear(); HTable->Clear();
vactive.clear();///new vactive.clear();///new
HTable->tempMark=0;
for (SimplexIterator si=_simplex.begin();si<_simplex.end();++si) for (SimplexIterator si=_simplex.begin();si<_simplex.end();++si)
{ {
if (!(*si).IsD()) if (!(*si).IsD())
@ -119,6 +120,7 @@ public:
void UpdateStep(Container_Type &simplex) void UpdateStep(Container_Type &simplex)
{ {
vactive.clear(); vactive.clear();
HTable->UpdateTmark();
for (Container_Type::iterator si=simplex.begin();si<simplex.end();++si) for (Container_Type::iterator si=simplex.begin();si<simplex.end();++si)
{ {
if ((!(*si).IsD())&&((*si).IsActive())) if ((!(*si).IsD())&&((*si).IsActive()))
@ -131,27 +133,27 @@ public:
} }
///put active cells on apposite structure /////put active cells on apposite structure
void AddElements(typename ContSimplex::iterator newSimplex) //void AddElements(typename ContSimplex::iterator newSimplex)
{ //{
while (newSimplex!=_simplex.end()) // while (newSimplex!=_simplex.end())
{ // {
if (!(*newSimplex).IsD()) // if (!(*newSimplex).IsD())
{ // {
if (!(*newSimplex).IsActive()) // if (!(*newSimplex).IsActive())
HTable->addSimplex(&*newSimplex); // HTable->addSimplex(&*newSimplex);
///new now // ///new now
else // else
{ // {
std::vector<Point3i> cells=HTable->addSimplex(&*newSimplex); // std::vector<Point3i> cells=HTable->addSimplex(&*newSimplex);
for(std::vector<Point3i>::iterator it=cells.begin();it<cells.end();it++) // for(std::vector<Point3i>::iterator it=cells.begin();it<cells.end();it++)
vactive.insert(*it); // vactive.insert(*it);
} // }
///end new now // ///end new now
} // }
newSimplex++; // newSimplex++;
} // }
} //}
///control the real self intersection in the mesh and returns the elements that intersect with someone ///control the real self intersection in the mesh and returns the elements that intersect with someone
std::vector<SimplexType*> computeSelfIntersection() std::vector<SimplexType*> computeSelfIntersection()
@ -161,7 +163,8 @@ public:
for (act=vactive.begin();act!=vactive.end();act++) for (act=vactive.begin();act!=vactive.end();act++)
{ {
Point3i p=*act; Point3i p=*act;
if (HTable->numElemCell(p)>=2) HashingTable::IteHtable I;
if (HTable->numElemCell(p,I)>=2)
{ {
std::vector<SimplexType*> inCell; std::vector<SimplexType*> inCell;
HTable->getAtCell(p,inCell); HTable->getAtCell(p,inCell);

View File

@ -106,6 +106,7 @@ public:
bool intersected; bool intersected;
float kdihedral; float kdihedral;
ScalarType AreaRep; ScalarType AreaRep;
int _Mark;
MyFace() MyFace()
{ {
@ -147,6 +148,9 @@ public:
return (norm1*norm2); return (norm1*norm2);
} }
int &Mark()
{return (_Mark);}
///return the bounding box of the simplex ///return the bounding box of the simplex
vcg::Box3<float> BBox() vcg::Box3<float> BBox()
{ {