Tweak movement
This commit is contained in:
@@ -72,11 +72,13 @@ normalizeV p = (1 / magV p) *.* p
|
||||
{- | Angle between two vectors. Always positive. -}
|
||||
angleVV :: Point2 -> Point2 -> Float
|
||||
{-# INLINE angleVV #-}
|
||||
angleVV a b =
|
||||
let ma = magV a
|
||||
mb = magV b
|
||||
d = a `dotV` b
|
||||
in acos $ d / (ma * mb)
|
||||
angleVV a b
|
||||
| a == b = 0
|
||||
| otherwise =
|
||||
let ma = magV a
|
||||
mb = magV b
|
||||
d = a `dotV` b
|
||||
in acos $ d / (ma * mb)
|
||||
{- | Safe version of 'angleVV' that returns 0 if either vector is null. -}
|
||||
safeAngleVV :: Point2 -> Point2 -> Float
|
||||
{-# INLINE safeAngleVV #-}
|
||||
|
||||
Reference in New Issue
Block a user