little optimisation
This commit is contained in:
parent
296ae4dfc2
commit
bc7de7e7eb
@ -102,12 +102,14 @@ function compute_gravity(fx, fy, body)
|
||||
|
||||
rx = fx - body%posx
|
||||
ry = fy - body%posy
|
||||
dist = sqrt( (rx*rx) + (ry*ry) )
|
||||
! ??? dist = sqrt( (rx*rx) + (ry*ry) )
|
||||
dist = (rx*rx) + (ry*ry)
|
||||
if (dist .LT. 0.08) then
|
||||
! write (0, *) "dist too small ", dist
|
||||
compute_gravity = 0e0
|
||||
else
|
||||
compute_gravity = body%mass / (dist ** 2)
|
||||
! ??? compute_gravity = body%mass / (dist ** 2)
|
||||
compute_gravity = body%mass / dist
|
||||
endif
|
||||
|
||||
end function
|
||||
|
Loading…
Reference in New Issue
Block a user