� Afc@s�dZddlmZmZmZmZddlmZdZ de fd��YZ defd��YZ d �Z ed kr�e �e�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 the 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#tobjectRRRFR(((s9/usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyts" '