Correctly intersect lines and circles
This commit is contained in:
@@ -194,16 +194,6 @@ ssaTriPoint' pa pb pc' bc
|
||||
= Nothing
|
||||
| otherwise
|
||||
= Just $ ssaTriPoint pa pb pc' bc
|
||||
-- | A potential correction of 'ssaTriPoint'.
|
||||
-- This should be tested and benchmarked.
|
||||
--ssaTriPointCorrect :: Point2 -> Point2 -> Point2 -> Float -> Maybe Point2
|
||||
--ssaTriPointCorrect pa pb pc' bc
|
||||
-- | param <= 1 && param >= 0 = Just p
|
||||
-- | otherwise = Nothing
|
||||
-- where
|
||||
-- p = ssaTriPoint pa pb pc' bc
|
||||
-- param = closestPointOnLineParam pa pc' p
|
||||
|
||||
-- | Return Just a point if it is inside a circle, Nothing otherwise.
|
||||
pointInCircle :: Point2 -> Float -> Point2 -> Maybe Point2
|
||||
pointInCircle p r c
|
||||
@@ -223,9 +213,6 @@ collidePointCirc' p1 p2 rad c = fmap (\x -> magV (x -.- p1))
|
||||
collidePointCirc'' :: Point2 -> Point2 -> Float -> Point2 -> Maybe (Point2,Float)
|
||||
collidePointCirc'' p1 p2 rad c = (,) <$> collidePointCirc p1 p2 rad c
|
||||
<*> collidePointCirc' p1 p2 rad c
|
||||
-- | As 'collidePointCirc', but uses the supposedly correct version of ssaTriPoint.
|
||||
--collidePointCircCorrect :: Point2 -> Point2 -> Float -> Point2 -> Maybe Point2
|
||||
--collidePointCircCorrect p1 p2 rad c = ssaTriPointCorrect p2 c p1 rad
|
||||
-- | Finds the height of a triangle using herons formula.
|
||||
-- The base is the line between the first two points.
|
||||
heron :: Point2 -> Point2 -> Point2 -> Float
|
||||
|
||||
Reference in New Issue
Block a user