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
-- in O(n).
intersectionPoints :: [PolyPT] -> [PT]
intersectionPoints [] = []
intersectionPoints xs' =
rmdups $
(++) (segIntersections . scanLine $ xs')
(intersectionPoints (tail xs'))
intersectionPoints xs' = rmdups . go $ xs'
where
go [] = []
go xs = (++) (segIntersections . scanLine $ xs)
(go (tail xs))
-- Get the scan line or in other words the
-- Segment pairs we are going to check for intersection.
scanLine :: [PolyPT] -> ([Segment], [Segment])