From 30be811103b3232b54c2567f3cebe7a6503a6de7 Mon Sep 17 00:00:00 2001 From: Dimitri Lozeve Date: Tue, 21 Nov 2017 15:29:39 +0000 Subject: [PATCH] Remove unnecessary calls to normalize --- src/Lib.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lib.hs b/src/Lib.hs index 75fa6bb..13c6208 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -232,7 +232,7 @@ buildTree bs = foldr insertBody (Empty r) bs -- | Field created by a body on a certain position field :: Body -> Point V3 Double -> V3 Double field body pos = - unP $ (gravity * m / r**2) *^ normalize vec + unP $ (gravity * m / r**3) *^ vec where m = _bodyMass body vec = _bodyPosition body - pos r = norm vec @@ -249,7 +249,7 @@ acceleration theta tree body = case tree of vec = _regionCenterOfMass r - _bodyPosition body d = norm vec in if s/d < theta then - unP $ (gravity * _regionMass r / d**2) *^ normalize vec + unP $ (gravity * _regionMass r / d**3) *^ vec else acceleration theta ned body + acceleration theta nwd body +