Improve xIntercepts (still not perfect)

This commit is contained in:
2025-10-22 22:07:45 +01:00
parent d5f985f3ab
commit 59472b16d2
9 changed files with 316 additions and 208 deletions
+6 -3
View File
@@ -13,6 +13,7 @@ module Dodge.WorldEvent.ThingsHit (
wlsHitRadial,
crHit,
crWlPbHit,
wlsHitUnsorted,
) where
import Linear
@@ -131,11 +132,13 @@ thingsHitExceptCr (Just cid) sp ep = filter t . thingsHit sp ep
t = (Just cid /=) . (^? _2 . _Left . crID)
wlsHit :: Point2 -> Point2 -> World -> [(Point2, Wall)]
wlsHit sp ep
wlsHit sp ep = sortOn (dist sp . fst) . wlsHitUnsorted sp ep
wlsHitUnsorted :: Point2 -> Point2 -> World -> [(Point2, Wall)]
wlsHitUnsorted sp ep
| sp == ep = const mempty
| otherwise =
sortOn (dist sp . fst)
. overlapSegWalls sp ep
overlapSegWalls sp ep
. wlsNearSeg sp ep
wlsHitRadial :: Point2 -> Float -> World -> [(Point2, Wall)]