[Haskell-cafe] ghci Crashing...
gcaruana at gmail.com
Mon Apr 16 11:04:41 EDT 2007
Hi all. I am new to this list ;) Today I have encountered something new that
has never happened to me in the past 6 months that I have been using ghci
I wrote this function:
type Line = (Point,Point)
type Point = (Float,Float)
circleLineIntersection :: Float -> Float -> Float -> Line -> Maybe [Point]
circleLineIntersection h k r ((x1,y1),(x2,y2)) = do
calcPerpDist (h,k) ((x1,y1),(x2,y2))
perpdist > r
perpdist == r
perpdist < r
if noSolution then
dx = x2 -
dy = y2 -
dr = sqrt
(dx * dx + dy * dy)
bigD = x1
* y2 - x2 * y1
x1 = (
bigD * dy + sign (dy) * dx * sqrt( r * r * dr * dr - bigD * bigD ) ) / (dr
y1 = -
bigD * dx + abs(dy) * sqrt( r * r * dr * dr - bigD * bigD ) / (dr * dr)
x2 = (
bigD * dy - sign (dy) * dx * sqrt( r * r * dr * dr - bigD * bigD ) ) / (dr
y2 = -
bigD * dx - abs(dy) * sqrt( r * r * dr * dr - bigD * bigD ) / (dr * dr)
Compiling is fine...
When I run the function like this....
circleLineIntersection 1 1 1 ((1,1),(2,2))
it simply outputs....
No CPU usage.
I am using fglasgow-exts
Thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe