From 3f45ae580ce53ae992cf68e8d98e08bfe80dc87b Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 9 Jul 2021 19:49:09 +0200 Subject: [PATCH] linted --- src/Physics/Classes/Collidible.hs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Physics/Classes/Collidible.hs b/src/Physics/Classes/Collidible.hs index e3829e9..50ea17c 100644 --- a/src/Physics/Classes/Collidible.hs +++ b/src/Physics/Classes/Collidible.hs @@ -28,9 +28,9 @@ class (Show c, Mass c) => Collidible c where -- as collision boundaries. boundary :: c -- ^ Object - -> ( V2 Double -- ^ Bottom left corner of AABB relative to position - , V2 Double -- ^ Top right corner of AABB relative to position - ) + -> ( V2 Double + , V2 Double + ) -- ^ Bottom left and top right corner of AABB relative to position collisionCheck :: (Collidible other) @@ -135,15 +135,14 @@ class (Show c, Mass c) => Collidible c where ) else let coll xdir = - let (p11, p12, p21, p22) = - if xdir - then + let (p11, p12, p21, p22) + | xdir = if d1x < 0 then (m1p1, m1p2, m2p4, m2p3) else (m1p4, m1p3, m2p1, m2p2) - else + | otherwise = if d1y < 0 then (m1p1, m1p4, m2p2, m2p3) @@ -177,12 +176,12 @@ class (Show c, Mass c) => Collidible c where (_, _, _, False, False) -> NoCollision (_, _, True, _, _) -> - A.log A.Debug ("CORNER CASE!") NoCollision + A.log A.Debug "CORNER CASE!" NoCollision (False, False, _, _, _) -> NoCollision x -> error $ "Unhandled combination of collision check results: " - <> (fromString $ show x) + <> fromString (show x) in res -- case res of @@ -226,10 +225,10 @@ elasticCollision damping mo1 mo2 (Collision ddt (V2 dirx _)) = if m2 == recip 0 then if dirx /= 0 - then (V2 (-v1x) v1y) - else (V2 v1x (-v1y)) - else (V2 v1x' v1y') + then V2 (-v1x) v1y + else V2 v1x (-v1y) + else V2 v1x' v1y' in - (velocityUpdater - ((positionUpdater mo1) (p1 + ((ddt *) <$> v1))) - ) nvel + velocityUpdater + (positionUpdater mo1 (p1 + ((ddt *) <$> v1))) + nvel