diff Framework/Toolbox/SlicesSorter.cpp @ 77:f5f54ed8d307 wasm

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 24 May 2017 21:13:29 +0200
parents ffa6dded91bd
children 53025eecbc95
line wrap: on
line diff
--- a/Framework/Toolbox/SlicesSorter.cpp	Wed May 24 12:42:08 2017 +0200
+++ b/Framework/Toolbox/SlicesSorter.cpp	Wed May 24 21:13:29 2017 +0200
@@ -192,4 +192,23 @@
 
     return found;
   }
+
+
+  bool SlicesSorter::LookupSlice(size_t& index,
+                                 const SliceGeometry& slice) const
+  {
+    // TODO Turn this linear-time lookup into a log-time lookup,
+    // keeping track of whether the slices are sorted along the normal
+
+    for (size_t i = 0; i < slices_.size(); i++)
+    {
+      if (slices_[i]->GetSlice().ContainsPlane(slice))
+      {
+        index = i;
+        return true;
+      }
+    }
+
+    return false;
+  }
 }