Move towards removal of ssaTri, which was buggy
This commit is contained in:
+14
-14
@@ -188,12 +188,12 @@ ssaTriPoint pa pb pc' bc
|
||||
ac = ssaTri ab bc a
|
||||
in pa +.+ (ac *.* errorNormalizeV 47 (pc' -.- pa))
|
||||
-- | Safe version of 'ssaTriPoint'.
|
||||
ssaTriPoint' :: Point2 -> Point2 -> Point2 -> Float -> Maybe Point2
|
||||
ssaTriPoint' pa pb pc' bc
|
||||
| dist pb (closestPointOnSeg pa pc' pb) >= bc
|
||||
= Nothing
|
||||
| otherwise
|
||||
= Just $ ssaTriPoint pa pb pc' bc
|
||||
--ssaTriPoint' :: Point2 -> Point2 -> Point2 -> Float -> Maybe Point2
|
||||
--ssaTriPoint' pa pb pc' bc
|
||||
-- | dist pb (closestPointOnSeg pa pc' pb) >= bc
|
||||
-- = Nothing
|
||||
-- | otherwise
|
||||
-- = Just $ ssaTriPoint pa pb pc' bc
|
||||
-- | Return Just a point if it is inside a circle, Nothing otherwise.
|
||||
pointInCircle :: Point2 -> Float -> Point2 -> Maybe Point2
|
||||
pointInCircle p r c
|
||||
@@ -203,16 +203,16 @@ pointInCircle p r c
|
||||
-- | Determines if a moving point intersects with a circle,
|
||||
-- if so, returns a point on circle that intersects with the line passing
|
||||
-- throught the circle : HOPEFULLY THE CORRECT OF THE TWO!
|
||||
collidePointCirc :: Point2 -> Point2 -> Float -> Point2 -> Maybe Point2
|
||||
collidePointCirc p1 p2 rad c = ssaTriPoint' p2 c p1 rad
|
||||
--collidePointCirc :: Point2 -> Point2 -> Float -> Point2 -> Maybe Point2
|
||||
--collidePointCirc p1 p2 rad c = ssaTriPoint' p2 c p1 rad
|
||||
-- | As 'collidePointCirc', but changes the point to a measure of the distance.
|
||||
collidePointCirc' :: Point2 -> Point2 -> Float -> Point2 -> Maybe Float
|
||||
collidePointCirc' p1 p2 rad c = fmap (\x -> magV (x -.- p1))
|
||||
(collidePointCirc p1 p2 rad c)
|
||||
--collidePointCirc' :: Point2 -> Point2 -> Float -> Point2 -> Maybe Float
|
||||
--collidePointCirc' p1 p2 rad c = fmap (\x -> magV (x -.- p1))
|
||||
-- (collidePointCirc p1 p2 rad c)
|
||||
-- | As 'collidePointCirc', but returns both the point and the measure of the distance.
|
||||
collidePointCirc'' :: Point2 -> Point2 -> Float -> Point2 -> Maybe (Point2,Float)
|
||||
collidePointCirc'' p1 p2 rad c = (,) <$> collidePointCirc p1 p2 rad c
|
||||
<*> collidePointCirc' p1 p2 rad c
|
||||
--collidePointCirc'' :: Point2 -> Point2 -> Float -> Point2 -> Maybe (Point2,Float)
|
||||
--collidePointCirc'' p1 p2 rad c = (,) <$> collidePointCirc p1 p2 rad c
|
||||
-- <*> collidePointCirc' p1 p2 rad c
|
||||
-- | 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