Your IP : 18.191.171.10


Current Path : /lib64/python3.8/turtledemo/__pycache__/
Upload File :
Current File : //lib64/python3.8/turtledemo/__pycache__/planet_and_moon.cpython-38.pyc

U

e5d�@s`dZddlmZmZmZmZdZGdd�de�Z	Gdd�de�Z
dd	�Zed
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$eZdZdd�Zdd�Zdd�ZdS)�GravSyscCsg|_d|_d|_dS)Nrg{�G�z�?)�planets�t�dt)�self�r�2/usr/lib64/python3.8/turtledemo/planet_and_moon.py�__init__szGravSys.__init__cCs|jD]}|��qdS)N)r�init)r�prrr
rs
zGravSys.initcCs6td�D](}|j|j7_|jD]}|��q"qdS)Ni')�ranger	r
r�step)r�irrrr
�start s
z
GravSys.startN)�__name__�
__module__�__qualname__rrrrrrr
rsrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�StarcCsTtj||d�|��||_|�|�||_|j�|�||_|�	d�|�
�dS)N)�shape�user)rrZpenup�m�setpos�vr�append�gravSysZ
resizemodeZpendown)rr�xrrrrrr
r's

z
Star.__init__cCs,|jj}|��|_|jd||j|_dS)N��?)rr
�acc�ar�rr
rrr
r1s
z	Star.initcCsRtdd�}|jjD]:}||kr|��|��}|t|jt|�d|7}q|S)Nr�)�Vecrr�pos�Gr�abs)rr#�planetrrrr
r"5s
 zStar.acccCsj|jj}|�|��||j�|jj�|�dkrJ|�|�|jjd��|�	�|_
|j||j
|_dS)Nr)rr
rr'rr�indexZ
setheadingZtowardsr"r#r$rrr
r<s
z	Star.stepN)rrrrrr"rrrrr
r&s
rcCs|t�}|��|���dd�|��|��|�d�|�d�|��|�	dd�|�
�|��}|��|�	dd�|�
�|��}td�}|�
|d�|�
|d�|���d|�|���d	d�t�}td
tdd�tdd�|d�}|�d
�|�d�|��tdtdd�tdd�|d�}|�d�|�d�td	tdd�tdd�|d�}|�d�|�d�|��|��dS)Nr��Z�ZcompoundZorangeZbluer*�i@Bg��circleZyellowg������?i�0����Zgreeng�������?��i'r!zDone!)r�resetZ	getscreenZtracerZhtZpu�fd�ltZ
begin_polyr0Zend_polyZget_polyrZaddcomponentZregister_shaperrr&ZcolorZ	shapesizeZpencolorrr)�sZm1Zm2ZplanetshapeZgsZsunZearthZmoonrrr
�mainFsD







r8�__main__N)
�__doc__Zturtlerrrrr&r(�objectrrr8rrrrr
�<module>s '

?>