POLYINT: run rmdups only once
This commit is contained in:
parent
ea06fe4fa1
commit
c765c63125
@ -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])
|
||||||
|
Loading…
Reference in New Issue
Block a user