Modularise shockwaves, stop landing self damage when blinking
This commit is contained in:
+14
-11
@@ -115,17 +115,20 @@ ratIntersectLineLine a b c d = fmap toNumPoint2 $ myIntersectLineLine (toRatPoin
|
||||
toNumPoint2 (x,y) = (fromRational x, fromRational y)
|
||||
f = toRatPoint2 . roundPoint2
|
||||
|
||||
-- | Round the floats within a 'Point2' to the nearest integer.
|
||||
-- Rounding jumps after intervals of .5:
|
||||
--
|
||||
-- >>> roundPoint (0.5,0.5001)
|
||||
-- (0.0,1.0)
|
||||
--
|
||||
-- but is symmetric around 0:
|
||||
--
|
||||
-- >>> roundPoint2 (0.5,-0.5)
|
||||
-- (0.0,0.0)
|
||||
--
|
||||
{- | Round the floats within a 'Point2' to the nearest integer.
|
||||
__Examples__
|
||||
Rounding jumps after intervals of .5:
|
||||
|
||||
>>> roundPoint (0.5,0.5001)
|
||||
(0.0,1.0)
|
||||
|
||||
but is symmetric around 0:
|
||||
|
||||
>>> roundPoint2 (0.5,-0.5)
|
||||
(0.0,0.0)
|
||||
|
||||
-}
|
||||
|
||||
roundPoint2 :: Point2 -> Point2
|
||||
roundPoint2 (x,y) = (fromIntegral $ round x,fromIntegral $ round y)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user