POLYINT: run rmdups only once

This commit is contained in:
hasufell 2014-10-31 17:49:08 +01:00
parent ea06fe4fa1
commit c765c63125
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -105,12 +105,12 @@ sortLexPolys _ = []
-- |Get all points that intersect between both polygons. This is done -- |Get all points that intersect between both polygons. This is done
-- in O(n). -- in O(n).
intersectionPoints :: [PolyPT] -> [PT] intersectionPoints :: [PolyPT] -> [PT]
intersectionPoints [] = [] intersectionPoints xs' = rmdups . go $ xs'
intersectionPoints xs' =
rmdups $
(++) (segIntersections . scanLine $ xs')
(intersectionPoints (tail xs'))
where where
go [] = []
go xs = (++) (segIntersections . scanLine $ xs)
(go (tail xs))
-- Get the scan line or in other words the -- Get the scan line or in other words the
-- Segment pairs we are going to check for intersection. -- Segment pairs we are going to check for intersection.
scanLine :: [PolyPT] -> ([Segment], [Segment]) scanLine :: [PolyPT] -> ([Segment], [Segment])