Add basic booster
This commit is contained in:
@@ -19,7 +19,7 @@ hasLOS p1 p2 w = not $ pointHitsWalls p1 p2 $ wallsAlongLine p1 p2 w
|
||||
reflectPointWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe (Point2,Point2)
|
||||
reflectPointWalls p1 p2 ws
|
||||
= listToMaybe
|
||||
. sortOn f
|
||||
. sortOn (dist p1 . fst)
|
||||
. IM.elems
|
||||
$ IM.mapMaybe
|
||||
(( \(x,y) ->
|
||||
@@ -29,8 +29,6 @@ reflectPointWalls p1 p2 ws
|
||||
(intersectSegSeg' p1 p2 x y)
|
||||
)
|
||||
. _wlLine) ws
|
||||
where
|
||||
f (a,_) = magV (p1 -.- a)
|
||||
-- | Looks for first collision of a point with walls.
|
||||
-- If found, gives point and reflection velocity, reflection damped in normal.
|
||||
reflectPointWallsDamped
|
||||
@@ -41,7 +39,7 @@ reflectPointWallsDamped
|
||||
-> Maybe (Point2,Point2)
|
||||
reflectPointWallsDamped dfact p1 p2 ws
|
||||
= listToMaybe
|
||||
. sortOn f
|
||||
. sortOn (dist p1 . fst)
|
||||
. IM.elems
|
||||
$ IM.mapMaybe
|
||||
(( \(x,y) -> fmap ((, reflectInParam dfact (x -.- y) (p2 -.- p1))
|
||||
@@ -49,8 +47,6 @@ reflectPointWallsDamped dfact p1 p2 ws
|
||||
(intersectSegSeg' p1 p2 x y))
|
||||
. _wlLine
|
||||
) ws
|
||||
where
|
||||
f (a,_) = magV (p1 -.- a)
|
||||
-- | Test if a point collides with walls
|
||||
pointHitsWalls :: Point2 -> Point2 -> IM.IntMap Wall -> Bool
|
||||
pointHitsWalls p1 p2
|
||||
|
||||
Reference in New Issue
Block a user