Browse Source

bug fix, wasn't reseting when growing on a new mesh

Former-commit-id: d425a7afb03bab7fdc6b2d104cba6f895a357e06
Alec Jacobson 9 years ago
parent
commit
e18ec0daed
2 changed files with 10 additions and 0 deletions
  1. 3 0
      include/igl/WindingNumberAABB.h
  2. 7 0
      include/igl/WindingNumberTree.h

+ 3 - 0
include/igl/WindingNumberAABB.h

@@ -126,6 +126,9 @@ inline void igl::WindingNumberAABB<Point>::grow()
 {
   using namespace std;
   using namespace Eigen;
+  // Clear anything that already exists
+  this->delete_children();
+
   //cout<<"cap.rows(): "<<this->getcap().rows()<<endl;
   //cout<<"F.rows(): "<<this->getF().rows()<<endl;
 

+ 7 - 0
include/igl/WindingNumberTree.h

@@ -59,6 +59,7 @@ namespace igl
         const WindingNumberTree<Point> & parent,
         const Eigen::MatrixXi & F);
       inline virtual ~WindingNumberTree();
+      inline void delete_children();
       inline virtual void set_mesh(
         const Eigen::MatrixXd & V,
         const Eigen::MatrixXi & F);
@@ -207,6 +208,12 @@ inline igl::WindingNumberTree<Point>::WindingNumberTree(
 
 template <typename Point>
 inline igl::WindingNumberTree<Point>::~WindingNumberTree()
+{
+  delete_children();
+}
+
+template <typename Point>
+inline void igl::WindingNumberTree<Point>::delete_children()
 {
   using namespace std;
   // Delete children