Correctly intersect lines and circles
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{- |
|
||||
Find which objects lie upon a line.
|
||||
-}
|
||||
@@ -121,7 +122,10 @@ thingsHitLongLine sp ep w
|
||||
| sp == ep = []
|
||||
| otherwise = sortOn (dist sp . fst) (crs ++ wls)
|
||||
where
|
||||
crs = zip crPs (map Left hitCrs)
|
||||
crs = mapMaybe
|
||||
(\cr -> (,Left cr) <$> listToMaybe (intersectCircSeg (_crPos cr) (_crRad cr) sp ep))
|
||||
. IM.elems $ _creatures w
|
||||
--crs = zip crPs (map Left hitCrs)
|
||||
hitCrs = IM.elems
|
||||
. IM.filter (\cr -> circOnSeg sp ep (_crPos cr) (_crRad cr))
|
||||
$ _creatures w
|
||||
|
||||
Reference in New Issue
Block a user