Add haddocks and/or cleanup
This commit is contained in:
+5
-5
@@ -180,7 +180,7 @@ wallOnLine p1 p2 ws
|
||||
|
||||
wallsOnCirc :: Point2 -> Float -> IM.IntMap Wall -> [Wall]
|
||||
wallsOnCirc p r wls = IM.elems $ IM.filter f wls
|
||||
where f wl = circOnLine (_wlLine wl !! 0) (_wlLine wl !! 1) p r
|
||||
where f wl = circOnSeg (_wlLine wl !! 0) (_wlLine wl !! 1) p r
|
||||
|
||||
wallsNearPoint :: Point2 -> World -> IM.IntMap Wall
|
||||
wallsNearPoint p w = IM.unions [f b $ f a $ _wallsZone w | a<-[x-1,x,x+1] , b<-[y-1,y,y+1]]
|
||||
@@ -653,11 +653,11 @@ collidePointCrsWithoutPoint cid p1 p2 w = fmap f $ listToMaybe $ sortBy (csndsnd
|
||||
f (cID,(p,_)) = (p,cID)
|
||||
|
||||
circOnSomeWall :: Point2 -> Float -> World -> Bool
|
||||
circOnSomeWall p rad w = any (\(x:y:_) -> circOnLine x y p rad)
|
||||
circOnSomeWall p rad w = any (\(x:y:_) -> circOnSeg x y p rad)
|
||||
$ fmap _wlLine $ IM.elems $ wallsNearPoint p w
|
||||
|
||||
crsNearLine :: Float -> [Point2] -> World -> Bool
|
||||
crsNearLine d (p1:p2:_) w = any (\c -> circOnLine p1 p2 (_crPos c) (d + _crRad c))
|
||||
crsNearLine d (p1:p2:_) w = any (\c -> circOnSeg p1 p2 (_crPos c) (d + _crRad c))
|
||||
$ IM.filter (\cr -> _crMass cr > 4) $ _creatures w
|
||||
|
||||
crsNearPoint :: Float -> Point2 -> World -> Bool
|
||||
@@ -665,12 +665,12 @@ crsNearPoint d p w = any (\c -> dist (_crPos c) p < (d + _crRad c)) (_creatures
|
||||
|
||||
crsOnLine :: Point2 -> Point2 -> World -> [Creature]
|
||||
crsOnLine p1 p2 w = IM.elems
|
||||
$ IM.filter (\cr -> circOnLine p1 p2 (_crPos cr) (_crRad cr))
|
||||
$ IM.filter (\cr -> circOnSeg p1 p2 (_crPos cr) (_crRad cr))
|
||||
$ _creatures w
|
||||
|
||||
crsOnThickLine :: Float -> Point2 -> Point2 -> World -> [Creature]
|
||||
crsOnThickLine thickness p1 p2 w = IM.elems
|
||||
$ IM.filter (\cr -> circOnLine p1 p2 (_crPos cr) (_crRad cr + thickness))
|
||||
$ IM.filter (\cr -> circOnSeg p1 p2 (_crPos cr) (_crRad cr + thickness))
|
||||
$ _creatures w
|
||||
|
||||
nearestCrInRad :: Point2 -> Float -> World -> Maybe Creature
|
||||
|
||||
Reference in New Issue
Block a user