Define a foldr "safe" minimum

This commit is contained in:
jgk
2021-08-18 19:16:42 +02:00
parent 349f4c2783
commit 61adae1e40
3 changed files with 28 additions and 29 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ furthestPointWalkable p1 p2 ws
collidePointIndirect :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe Point2
{-# INLINE collidePointIndirect #-}
collidePointIndirect p1 p2 ws
= safeMinimumOn (dist p1)
= safeMinimumOnr (dist p1)
. IM.mapMaybe ( uncurry (intersectSegSeg p1 p2) . _wlLine)
$ IM.filter (not . _wlIsSeeThrough) ws
{- | Checks to see whether someone can fire bullets effectively between two points.