]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Cube.hs
Added a find_containing_tetrahedra function to the Cube module.
[spline3.git] / src / Cube.hs
index 5b5f2af690d3230bf06595ae133a05b313b840a3..6b2121cf117ed98e6d25b6a37f02a0a8341841ee 100644 (file)
@@ -460,3 +460,13 @@ tetrahedrons c =
      tetrahedron21 c,
      tetrahedron22 c,
      tetrahedron23 c]
+
+
+-- | Takes a 'Cube', and returns all Tetrahedra belonging to it that
+--   contain the given 'Point'.
+find_containing_tetrahedra :: Cube -> Point -> [Tetrahedron]
+find_containing_tetrahedra c p =
+    filter contains_our_point all_tetrahedra
+    where
+      contains_our_point = flip contains_point p
+      all_tetrahedra = tetrahedrons c