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

View File

@ -106,13 +106,14 @@ public:
bool intersected;
float kdihedral;
ScalarType AreaRep;
int _Mark;
MyFace()
{
intersected=false;
ClearFlags();
}
void Init ( double k, double mass,float k_dihedral )
{
__super::Init(k,mass);
@ -147,6 +148,9 @@ public:
return (norm1*norm2);
}
int &Mark()
{return (_Mark);}
///return the bounding box of the simplex
vcg::Box3<float> BBox()
{