Use tasty for tests, fix bug in circOnLine
This commit is contained in:
@@ -77,6 +77,7 @@ intersectSegLine (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
--u' = (y1-y2)*(x1-x3) - (x1-x2)*(y1-y3)
|
||||
-- | It is not always necessary to find a point of intersection, sometimes a
|
||||
-- test may suffice.
|
||||
-- IS THIS CORRECT? -- TODO tests
|
||||
intersectSegSegTest
|
||||
:: Point2
|
||||
-> Point2
|
||||
@@ -84,11 +85,11 @@ intersectSegSegTest
|
||||
-> Point2
|
||||
-> Bool
|
||||
{-# INLINE intersectSegSegTest #-}
|
||||
intersectSegSegTest a' b' c' d'
|
||||
= f a' b' c' d' && f c' d' a' b'
|
||||
intersectSegSegTest x y z w
|
||||
= f x y z w && f z w x y
|
||||
where
|
||||
f a b c d = ( isLHS a b c && not (isLHS a b d) )
|
||||
|| ( not (isLHS a b c) && isLHS a b d )
|
||||
f a b c d = ( not (isRHS a b c) && not (isLHS a b d) )
|
||||
|| ( not (isLHS a b c) && not (isRHS a b d) )
|
||||
intersectSegSegPreTest
|
||||
:: Point2
|
||||
-> Point2
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ module Geometry.LHS
|
||||
, isRHS
|
||||
) where
|
||||
import Geometry.Data
|
||||
-- | Test whether a point is on the LHS of a line.
|
||||
-- | Test whether a point is stricly on the LHS of a line.
|
||||
-- Returns False if the line is of zero length.
|
||||
isLHS
|
||||
:: Point2 -- ^ First line point.
|
||||
|
||||
Reference in New Issue
Block a user