
7 Dec
2010
7 Dec
'10
8:14 p.m.
On Mon, 6 Dec 2010, vince vegga wrote:
Hi,
Here is my Haskell implementation of the Shamos and Hoey algorithm for detecting segments intersection in the plane:
http://neonstorm242.blogspot.com/2010/12/sweep-line-algorithm-for-detection -of.html
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: http://www.haskell.org/haskellwiki/Haskell_programming_tips and in http://www.haskell.org/haskellwiki/Category:Style