Your IP : 18.222.179.96
U
e5d�
� @ sT d Z ddlT ddlmZmZ G dd� de�Zdd� Ze dkrPe� Z
ee
� e� d S )
a& turtle-example-suite:
tdemo_fractalCurves.py
This program draws two fractal-curve-designs:
(1) A hilbert curve (in a box)
(2) A combination of Koch-curves.
The CurvesTurtle class and the fractal-curve-
methods are taken from the PythonCard example
scripts for turtle-graphics.
� )�*)�sleep�perf_counterc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�CurvesTurtlec C s� |dkrd S | � |d � | �||d | � | �|� | �|d � | �||d |� | �|� | �||d |� | �|d � | �|� | �||d | � | � |d � d S )Nr �Z � )�left�hilbertZforward�right)�self�size�levelZparity� r �0/usr/lib64/python3.8/turtledemo/fractalcurves.pyr s
zCurvesTurtle.hilbertc C s� dd l }d| |�|j| � }| �� | �|� | �� | �dd|d | � t|�D ] }| �|||� | �d| � q\| � dd|d | � | �� | �
|� | �� d S )Nr � � r ih )�mathZsinZpi�pu�fd�pd�rt�range�fractal�ltZbk)r �nZradZlev�dirr Zedge�ir r r �
fractalgon/ s
zCurvesTurtle.fractalgonc C s� |dk r| � |� d S | �|d |d |� | �d| � | �|d |d |� | �d| � | �|d |d |� | �d| � | �|d |d |� d S )Nr � �<