???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
Afc           @   s”   d  Z  d d l m Z m Z m Z m Z d d l m Z d Z	 d e
 f d „  ƒ  YZ d e f d „  ƒ  YZ d	 „  Z e d
 k r e ƒ  e ƒ  n  d 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ÿÿÿÿ(   t   Shapet   Turtlet   mainloopt   Vec2D(   t   sleepi   t   GravSysc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s   g  |  _  d |  _ d |  _ d  S(   Ni    g{®Gáz„?(   t   planetst   tt   dt(   t   self(    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyt   __init__   s    		c         C   s"   x |  j  D] } | j ƒ  q
 Wd  S(   N(   R   t   init(   R	   t   p(    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR      s    c         C   sK   xD t  d ƒ D]6 } |  j |  j 7_ x |  j D] } | j ƒ  q/ Wq Wd  S(   Ni'  (   t   rangeR   R   R   t   step(   R	   t   iR   (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyt   start!   s    (   t   __name__t
   __module__R
   R   R   (    (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR      s   		t   Starc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   sp   t  j |  d | ƒ|  j ƒ  | |  _ |  j | ƒ | |  _ | j j |  ƒ | |  _ |  j	 d ƒ |  j
 ƒ  d  S(   Nt   shapet   user(   R   R
   t   penupt   mt   setpost   vR   t   appendt   gravSyst
   resizemodet   pendown(   R	   R   t   xR   R   R   (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR
   (   s    
			c         C   s:   |  j  j } |  j ƒ  |  _ |  j d | |  j |  _ d  S(   Ng      à?(   R   R   t   acct   aR   (   R	   R   (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR   2   s    c         C   sr   t  d d ƒ } x\ |  j j D]N } | |  k r | j ƒ  |  j ƒ  } | t | j t | ƒ d | 7} q q W| S(   Ni    i   (   t   VecR   R   t   post   GR   t   abs(   R	   R    t   planetR   (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR   6   s    *c         C   s’   |  j  j } |  j |  j ƒ  | |  j ƒ |  j  j j |  ƒ d k rh |  j |  j |  j  j d ƒ ƒ n  |  j	 ƒ  |  _
 |  j | |  j
 |  _ d  S(   Ni    (   R   R   R   R"   R   R   t   indext
   setheadingt   towardsR   R    (   R	   R   (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR   =   s    #(   R   R   R
   R   R   R   (    (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyR   '   s   	
		c          C   sú  t  ƒ  }  |  j ƒ  |  j d d ƒ |  j ƒ  |  j ƒ  |  j d ƒ |  j d ƒ |  j ƒ  |  j d d ƒ |  j	 ƒ  |  j
 ƒ  } |  j ƒ  |  j d d ƒ |  j	 ƒ  |  j
 ƒ  } t d ƒ } | j | d ƒ | j | d ƒ |  j ƒ  j d | ƒ |  j d	 d ƒ t ƒ  } t d
 t d d ƒ t d d ƒ | d ƒ } | j d ƒ | j d ƒ | j ƒ  t d t d d ƒ t d d ƒ | d ƒ } | j d ƒ | j d ƒ t d	 t d d ƒ t d d ƒ | d ƒ } | j d ƒ | j d ƒ | j ƒ  | j ƒ  d S(   Ni    i   iZ   i´   t   compoundt   oranget   blueR%   i   i@B g      Àt   circlet   yellowgÍÌÌÌÌÌü?iÔ0  iÒ   iÃ   t   greengš™™™™™é?iÜ   i'  g      à?s   Done!(   R   t   resett   tracert   htt   put   fdt   ltt
   begin_polyR,   t   end_polyt   get_polyR    t   addcomponentt	   getscreent   register_shapeR   R   R!   t   colort	   shapesizet   pencolorR   R   (   t   st   m1t   m2t   planetshapet   gst   sunt   eartht   moon(    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyt   mainG   sD    	






	*
**

t   __main__N(   t   __doc__t   turtleR    R   R   R   R!   t   timeR   R#   t   objectR   R   RF   R   (    (    (    s9   /usr/lib64/python2.7/Demo/turtle/tdemo_planet_and_moon.pyt   <module>   s   " 	'