From b855e951d7614defc4ccc1ff5a8c3711300e0107 Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Wed, 15 Jun 2005 10:09:41 +0000 Subject: [PATCH] updated with new spatial hashing version --- .../test/segmentation3d/collision_detection.h | 47 ++++++++++--------- apps/test/segmentation3d/segmentator.h | 6 ++- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/apps/test/segmentation3d/collision_detection.h b/apps/test/segmentation3d/collision_detection.h index c8dabac0..746de764 100644 --- a/apps/test/segmentation3d/collision_detection.h +++ b/apps/test/segmentation3d/collision_detection.h @@ -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();siaddSimplex(&*newSimplex); - ///new now - else - { - std::vector cells=HTable->addSimplex(&*newSimplex); - for(std::vector::iterator it=cells.begin();itaddSimplex(&*newSimplex); + // ///new now + // else + // { + // std::vector cells=HTable->addSimplex(&*newSimplex); + // for(std::vector::iterator it=cells.begin();it 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 inCell; HTable->getAtCell(p,inCell); diff --git a/apps/test/segmentation3d/segmentator.h b/apps/test/segmentation3d/segmentator.h index f56ba2e7..96901331 100644 --- a/apps/test/segmentation3d/segmentator.h +++ b/apps/test/segmentation3d/segmentator.h @@ -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 BBox() {