[MWForum]Elliptical orbits for planets
Mike Sandy
mwforum@lists.mathcats.com
Sat, 8 Mar 2003 17:53:10 -0000
Jeff wrote:
>Note towards always sets heading to an integer value,
>which is a terribly rough approximation. If you are
>keeping a running total of deflections based on
>values supplied by towards, very large errors
>can accumulate.
In fact ,with the ellipse, I found this is not a problem.
The error occurs also with MW Pro so I've redefined
TOWARDS
to h.towards :t
let[p pos
p1 ask(list :t)(list "pos)
x (first :p1) - first :p
y (last :p1)- last :p]
seth 90 - atan :x :y
end
to atan :x :y
if and :x = 0 :y = 0[op 0]
if :x = 0[if :y > 0[op 90]
op 270]
if :y = 0[if :x > 0[op 0]
op 180]
if :x > 0[op arctan :y / :x]
op 180 + arctan :y/:x
end
Mike