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
|
rx = fx - body%posx
|
||||||
ry = fy - body%posy
|
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
|
if (dist .LT. 0.08) then
|
||||||
! write (0, *) "dist too small ", dist
|
! write (0, *) "dist too small ", dist
|
||||||
compute_gravity = 0e0
|
compute_gravity = 0e0
|
||||||
else
|
else
|
||||||
compute_gravity = body%mass / (dist ** 2)
|
! ??? compute_gravity = body%mass / (dist ** 2)
|
||||||
|
compute_gravity = body%mass / dist
|
||||||
endif
|
endif
|
||||||
|
|
||||||
end function
|
end function
|
||||||
|
Loading…
Reference in New Issue
Block a user