ó 6”þfc@s›dZddlmZmZmZmZddlmZdZ de fd„ƒYZ defd„ƒYZ d „Z ed kr—e ƒZeGHeƒnd S( s¬ turtle-example-suite: tdemo_planets_and_moon.py Gravitational system simulation using the approximation method from Feynman-lectures, p.9-8, using turtlegraphics. Example: heavy central body, light planet, very light moon! Planet has a circular orbit, moon a stable orbit around the planet. You can hold the movement temporarily by pressing the left mouse button with mouse over the scrollbar of the canvas. iÿÿÿÿ(tShapetTurtletmainlooptVec2D(tsleepitGravSyscBs#eZd„Zd„Zd„ZRS(cCsg|_d|_d|_dS(Nig{®Gáz„?(tplanetstttdt(tself((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyt__init__s  cCs"x|jD]}|jƒq WdS(N(Rtinit(R tp((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR scCsKxDtdƒD]6}|j|j7_x|jD]}|jƒq/Wq WdS(Ni'(trangeRRRtstep(R tiR ((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pytstart!s(t__name__t __module__R R R(((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyRs  tStarcBs,eZd„Zd„Zd„Zd„ZRS(cCsptj|d|ƒ|jƒ||_|j|ƒ||_|jj|ƒ||_|j dƒ|j ƒdS(Ntshapetuser( RR tpenuptmtsetpostvRtappendtgravSyst resizemodetpendown(R RtxRRR((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR (s      cCs:|jj}|jƒ|_|jd||j|_dS(Ngà?(RRtacctaR(R R((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR 2s cCsrtddƒ}x\|jjD]N}||kr|jƒ|jƒ}|t|jt|ƒd|7}qqW|S(Nii(tVecRRtpostGRtabs(R R tplanetR((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR6s  *cCs’|jj}|j|jƒ||jƒ|jjj|ƒdkrh|j|j|jjdƒƒn|j ƒ|_ |j||j |_dS(Ni( RRRR"RRtindext setheadingttowardsRR (R R((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR=s  #(RRR R RR(((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR's  cCsútƒ}|jƒ|jddƒ|jƒ|jƒ|jdƒ|jdƒ|jƒ|jddƒ|j ƒ|j ƒ}|jƒ|jddƒ|j ƒ|j ƒ}t dƒ}|j |dƒ|j |dƒ|j ƒjd|ƒ|jd dƒtƒ}td tddƒtdd ƒ|d ƒ}|jd ƒ|jdƒ|jƒtdtddƒtddƒ|dƒ}|jdƒ|jdƒtd tddƒtddƒ|dƒ}|jdƒ|jdƒ|jƒ|jƒdS(NiiiZi´tcompoundtorangetblueR%ii@BgÀtcircletyellowgÍÌÌÌÌÌü?iÔ0iÒiÃtgreengš™™™™™é?iÜi'gà?sDone!(Rtresetttracerthttputfdtltt begin_polyR,tend_polytget_polyRt addcomponentt getscreentregister_shapeRRR!tcolort shapesizetpencolorR R(tstm1tm2t planetshapetgstsuntearthtmoon((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pytmainGsD              *   *  *    t__main__N(t__doc__tturtleRRRRR!ttimeRR#tobjectRRRFRtmsg(((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyts" '