Split Dodge.Base
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user