1 -- | The Face module just contains the definition of the 'Face' data
2 -- type and its two typeclass instances.
9 import Point ( Point, scale )
11 data Face = Face { v0 :: !Point,
17 instance Show Face where
18 show (Face v0' v1' v2' v3') =
20 " v0: " ++ (show v0') ++ "\n" ++
21 " v1: " ++ (show v1') ++ "\n" ++
22 " v2: " ++ (show v2') ++ "\n" ++
23 " v3: " ++ (show v3') ++ "\n"
25 -- | Returns the center of the given face. Since a face is just
26 -- square, we can average the four vertices to find its center. This
27 -- is useful because the center of a face is always a vertex of a
29 center :: Face -> Point
30 center (Face v0' v1' v2' v3') =
31 (v0' + v1' + v2' + v3') `scale` (1/4)