File: //lib64/python3.8/turtledemo/__pycache__/planet_and_moon.cpython-38.opt-1.pyc
U
e5d ã @ s` d Z ddlmZmZmZmZ dZG dd„ deƒZ G dd„ deƒZ
dd „ Zed
kr\eƒ eƒ dS )a° 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.
é )ÚShapeÚTurtleÚmainloopÚVec2Dé c @ s$ e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚGravSysc C s g | _ d| _d| _d S )Nr g{®Gáz„?)ÚplanetsÚtÚdt)Úself© r ú2/usr/lib64/python3.8/turtledemo/planet_and_moon.pyÚ__init__ s zGravSys.__init__c C s | j D ]}| ¡ qd S )N)r Úinit)r Úpr r r
r s
zGravSys.initc C s6 t dƒD ](}| j| j7 _| jD ]}| ¡ q"qd S )Ni' )Úranger r
r Ústep)r Úir r r r
Ústart s
z
GravSys.startN)Ú__name__Ú
__module__Ú__qualname__r r r r r r r
r s r c @ s, e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd S )
ÚStarc C sT t j| |d | ¡ || _| |¡ || _|j | ¡ || _| d¡ |
¡ d S )N)ÚshapeÚuser)r r ZpenupÚmÚsetposÚvr ÚappendÚgravSysZ
resizemodeZpendown)r r Úxr r r r r r
r ' s
z
Star.__init__c C s, | j j}| ¡ | _| jd| | j | _d S )Nç à?)r r
ÚaccÚar ©r r
r r r
r 1 s
z Star.initc C sR t ddƒ}| jjD ]:}|| kr| ¡ | ¡ }|t|j t|ƒd | 7 }q|S )Nr é )ÚVecr r ÚposÚGr Úabs)r r# Úplanetr r r r
r"