[Haskell-cafe] An Haskell implementation of a sweep line algorithm for the detection of segments intersection
lemming at henning-thielemann.de
Tue Dec 7 21:14:29 CET 2010
On Mon, 6 Dec 2010, vince vegga wrote:
> Here is my Haskell implementation of the Shamos and Hoey algorithm for
> detecting segments intersection in the plane:
> I'm new to Haskell, so any useful comments will be appreciated.
In sweepLine, things like
| a = False
| otherwise = x
can be written as (not a && x) and
if a then True else x
as (a || x).
In handleLeftEndpoint you can create (events,updateLine) outside the case
analysis, since this is common to all cases.
In general you can find hints in:
More information about the Haskell-Cafe