Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/turtledemo/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/turtledemo/__pycache__/planet_and_moon.cpython-35.pyc



��Yf,�@s�dZddlmZmZmZmZddlmZdZ	Gdd�de
�ZGdd�de�Zd	d
�Z
edkr�e
�e�dS)
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)�sleep�c@s4eZdZdd�Zdd�Zdd�ZdS)�GravSyscCsg|_d|_d|_dS)Nrg{�G�z�?)�planets�t�dt)�self�r
�?/opt/alt/python35/lib64/python3.5/turtledemo/planet_and_moon.py�__init__s		zGravSys.__init__cCs"x|jD]}|j�q
WdS)N)r	�init)r�pr
r
rrszGravSys.initcCsKxDtd�D]6}|j|j7_x|jD]}|j�q/Wq
WdS)Ni')�ranger
rr	�step)r�irr
r
r�start!sz
GravSys.startN)�__name__�
__module__�__qualname__rrrr
r
r
rrsrc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�StarcCsptj|d|�|j�||_|j|�||_|jj|�||_|j	d�|j
�dS)N�shape�user)rrZpenup�m�setpos�vr	�append�gravSysZ
resizemodeZpendown)rr�xrr rr
r
rr(s
	
		
z
Star.__init__cCs:|jj}|j�|_|jd||j|_dS)Ng�?)r r�acc�ar)rrr
r
rr2sz	Star.initcCsotdd�}xY|jjD]K}||kr|j�|j�}|t|jt|�d|7}qW|S)Nr�)�Vecr r	�pos�Gr�abs)rr#�planetrr
r
rr"6s'zStar.acccCs�|jj}|j|j�||j�|jjj|�dkre|j|j|jjd��|j	�|_
|j||j
|_dS)Nr)r rrr&rr	�indexZ
setheadingZtowardsr"r#)rrr
r
rr=s z	Star.stepN)rrrrrr"rr
r
r
rr's
rcCst�}|j�|j�jdd�|j�|j�|jd�|jd�|j�|j	dd�|j
�|j�}|j�|j	dd�|j
�|j�}td�}|j
|d�|j
|d�|j�jd|�|j�jd	d�t�}td
tdd�tdd�|d�}|jd
�|jd�|j�tdtdd�tdd�|d�}|jd�|jd�td	tdd�tdd�|d�}|jd�|jd�|j�|j�dS)Nr��Z�ZcompoundZorangeZbluer)�i@Bg@�circleZyellowg������?i�0����Zgreeng�������?��i'g�?zDone!g�)r�resetZ	getscreenZtracerZhtZpu�fd�ltZ
begin_polyr/Zend_polyZget_polyrZaddcomponentZregister_shaperrr%ZcolorZ	shapesizeZpencolorrr)�s�m1�m2ZplanetshapeZgsZsunZearthZmoonr
r
r�mainGsD	








	*


*

*



r9�__main__N)�__doc__Zturtlerrrrr%Ztimerr'�objectrrr9rr
r
r
r�<module>s" '