Split Dodge.Base

This commit is contained in:
2022-06-19 11:34:59 +01:00
parent 6cc29813d8
commit df1f3ad6b0
15 changed files with 106 additions and 88 deletions
+15
View File
@@ -14,6 +14,8 @@ module Dodge.Base.Collide
, hasLOSIndirect
, wlIsOpaque
, wlIsSeeThrough
, wallsOnCirc
, wallsOnLineHit
) where
import Dodge.Data
import Dodge.Zone
@@ -308,3 +310,16 @@ canSeeIndirect i j w = not
-- n = normalizeV $ vNormal $ ipos -.- jpos
-- ni = _crRad icr *.* n
-- nj = _crRad jcr *.* n
wallsOnLineHit :: Point2 -> Point2 -> IM.IntMap Wall -> IM.IntMap (Point2, Wall)
wallsOnLineHit p1 p2 = IM.mapMaybe f
where
f wl = uncurry (intersectSegSeg p1 p2) (_wlLine wl) <&> (, wl)
wallsOnCirc :: Point2 -> Float -> IM.IntMap Wall -> IM.IntMap Wall
wallsOnCirc p r = IM.filter f
where
f wl = uncurry circOnSeg (_wlLine wl) p r
--wallNormal :: Wall -> Point2
--wallNormal = normalizeV . vNormal . uncurry (-.-) . _wlLine