From c8541f59b42ec4036ccf17bcb982394d6a4730fc Mon Sep 17 00:00:00 2001 From: hasufell Date: Mon, 12 Jan 2015 22:38:10 +0100 Subject: [PATCH] ALGO: use 'Segment' instead of '(PT, PT)' --- Algorithms/PolygonTriangulation.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Algorithms/PolygonTriangulation.hs b/Algorithms/PolygonTriangulation.hs index 7a5ac9e..cde57c1 100644 --- a/Algorithms/PolygonTriangulation.hs +++ b/Algorithms/PolygonTriangulation.hs @@ -126,10 +126,10 @@ monotonePartitioning pts -- |Try to eliminate the merge and split vertices by computing the -- diagonals we have to use for splitting the polygon. This doesn't -- necessarily make our polygon y-monotone yet. -monotoneDiagonals :: [PT] -> [(PT, PT)] +monotoneDiagonals :: [PT] -> [Segment] monotoneDiagonals pts = catMaybes . go $ classifyList pts where - go :: [(PT, VCategory)] -> [Maybe (PT, PT)] + go :: [(PT, VCategory)] -> [Maybe Segment] go (x:xs) = case snd x of VMerge -> getSeg (belowS . fst $ x) (fst x) : go xs VSplit -> getSeg (aboveS . fst $ x) (fst x) : go xs @@ -137,7 +137,7 @@ monotoneDiagonals pts = catMaybes . go $ classifyList pts go [] = [] getSeg :: [PT] -- all points above/below the current point -> PT -- current point - -> Maybe (PT, PT) + -> Maybe Segment getSeg [] _ = Nothing getSeg (z:zs) pt | isInsidePoly pts (z, pt) = Just (z, pt)