]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Face.hs
Clean up imports/exports.
[spline3.git] / src / Face.hs
index bc1dfeee1b8067ccda3ccff433cb5107a862c9a1..96092609fc55f99cc86459ebf787f26594efff1f 100644 (file)
@@ -1,4 +1,7 @@
+-- | The Face module just contains the definition of the 'Face' data
+--   type and its two typeclass instances.
 module Face
+  ( Face(..) )
 where
 
 import Point
@@ -17,67 +20,16 @@ instance Show Face where
              "  v2: " ++ (show (v2 f)) ++ "\n" ++
              "  v3: " ++ (show (v3 f)) ++ "\n"
 
+-- | The 'Face' type is an instance of 'ThreeDimensional' so that we
+--   can call the 'center' function on it. This is useful because the
+--   center of a face is always a vertex of a tetrahedron.
 instance ThreeDimensional Face where
+    -- | Since a face is square, we can just average the four vertices
+    --   to find the center.
     center f = ((v0 f) + (v1 f) + (v2 f) + (v3 f)) `scale` (1/4)
-    -- Too lazy to implement this right now.
-    contains_point _ _ = False
-
-
--- tetrahedron0 :: Face -> Tetrahedron
--- tetrahedron0 f =
---     Tetrahedron c v0' v1' v2' v3'
---     where
---       c = cube f
---       v0' = v0 f
---       v1' = v1 f
---       v2' = center f
---       v3' = center c
-
--- tetrahedron1 :: Face -> Tetrahedron
--- tetrahedron1 f =
---     Tetrahedron c v0' v1' v2' v3'
---     where
---       c = cube f
---       v0' = v1 f
---       v1' = v2 f
---       v2' = center f
---       v3' = center c
-
 
--- tetrahedron2 :: Face -> Tetrahedron
--- tetrahedron2 f =
---     Tetrahedron c v0' v1' v2' v3'
---     where
---       c = cube f
---       v0' = v2 f
---       v1' = v3 f
---       v2' = center f
---       v3' = center c
-
-
--- tetrahedron3 :: Face -> Tetrahedron
--- tetrahedron3 f =
---     Tetrahedron c v0' v1' v2' v3'
---     where
---       c = cube f
---       v0' = v3 f
---       v1' = v0 f
---       v2' = center f
---       v3' = center c
-
--- tetrahedrons :: Cube -> [Tetrahedron]
--- tetrahedrons c =
---     concat [
---  [tetrahedron0 f0, tetrahedron1 f0, tetrahedron2 f0, tetrahedron3 f0],
---  [tetrahedron0 f1, tetrahedron1 f1, tetrahedron2 f1, tetrahedron3 f2],
---  [tetrahedron0 f2, tetrahedron1 f2, tetrahedron2 f2, tetrahedron3 f2],
---  [tetrahedron0 f3, tetrahedron1 f3, tetrahedron2 f3, tetrahedron3 f3],
---  [tetrahedron0 f4, tetrahedron1 f4, tetrahedron2 f4, tetrahedron3 f4],
---  [tetrahedron0 f5, tetrahedron1 f5, tetrahedron2 f5, tetrahedron3 f5] ]
---     where
---       f0 = face0 c
---       f1 = face1 c
---       f2 = face2 c
---       f3 = face3 c
---       f4 = face4 c
---       f5 = face5 c
+    -- | It's possible to implement this, but it hasn't been done
+    --   yet. A face will contain a point if the point lies in the same
+    --   plane as the vertices of the face, and if it falls on the
+    --   correct side of the four sides of the face.
+    contains_point _ _ = False