Python Turtle Spirograph

In this blog post we will create a spirograph using Python Turtle to draw different types of curves.

Did you know?


A Spirograph is a geometric drawing toy that produces mathematical roulette curves of the variety technically known as hypotrochoids and epitrochoids. It was developed by British engineer Denys Fisher and first sold in 1965.

Examples of patterns created using a spirograph:
Spirograph_Designs

HypotrochoidHypocycloidEpicycloidEpitrochoidCycloid
A hypotrochoid is a type of curve traced by a point attached to a circle of radius r rolling around the inside of a fixed circle of radius R, where the point is a distance d from the center of the interior circle.

The parametric equations for a hypotrochoid are:
hypotrochoid-formulas

Where θ (theta) is the angle formed by the horizontal and the center of the rolling circle.

Source: https://en.wikipedia.org/wiki/Hypotrochoid

You can tweak the Python code provided below to change the three key parameters: R, r and d to see their impacts on the hypotrochoid curve.

Find out the properties of an Hypocycloid (https://en.wikipedia.org/wiki/Hypocycloid) and adapt the Python code (see below) to create your own Hypocycloid curves.

The parametric equations for a hypocycloid are:
hypocycloid-formulas

Find out the properties of an Epicycloid (https://en.wikipedia.org/wiki/Epicycloid) and adapt the Python code (see below) to create your own Epicycloid curves.

The parametric equations for an epicycloid are:
epicycloid-formulas

Find out the properties of an Epicycloid (https://en.wikipedia.org/wiki/Epitrochoid) and adapt the Python code (see below) to create your own Epitrochoid curves.

The parametric equations for an epitrochoid are:
epitrochoid-formulas

A cycloid is the curve traced by a point on the rim of a circular wheel as the wheel rolls along a straight line without slipping.

Find out the properties of a Cycloid (https://en.wikipedia.org/wiki/Cycloid) and adapt the Python code (see below) to create your own Cycloid curves.


Python Turtle Spirograph: (Hypotrochoid)


Spirograph Pattern:


By changing some of the parameters (r, R or d) and the number of iterations (steps) we can create more advanced patterns.

Share Button
Tagged with: