Spiral of Spirals¶
By the end of this lab you'll be able to:
- Write a reusable
mini_spiral(x, y, facing)function that draws a small spiral - Arrange multiple spiral instances in a circle using
math.cos()andmath.sin() - Understand how a micro-pattern repeated at macro scale creates fractal-like complexity
Twelve small square spirals are arranged in a ring, each one rotated to face outward from the center. From a distance the whole arrangement looks like a single rotating burst.
Welcome to the Spiral of Spirals!
This lab combines two ideas: the spiral you already know and the rotation-around-a-circle
trick from the pinwheel. Together they create something much richer than either alone.
Let's code it together!
How It Works¶
A mini_spiral() function draws a small 30-step square spiral at a given (x, y) position and starting heading. The outer loop places 12 of these spirals evenly around a circle of radius 150, each one facing outward (heading = angle from center).
Sample Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
What Do You Think Will Happen?
Each small spiral starts facing outward from the center.
Will the 12 small spirals overlap each other, or will they stay separate?
Make your guess — then click Run to find out!
Try It Now¶
The spirals mostly stay separate — each one starts 30 segments long and grows inward toward the center gap. Were you right?
How It Works¶
setheading(angle) makes each spiral face outward — the heading equals the angle around the circle. This is because the position angle and the outward-facing angle are the same number when measured from the East direction.
The outer loop generates coordinates with x = r·cos(angle), y = r·sin(angle) — the standard polar-to-Cartesian conversion.
Explanation Table¶
| Line | What it does |
|---|---|
def mini_spiral(x, y, facing, color) |
Reusable function: draws one small spiral |
monty.setheading(facing) |
Point each spiral outward from the center |
radius = 150 |
Distance from center to each spiral's start |
angle = i * 30 |
12 spirals × 30° = full 360° circle |
x = radius * math.cos(math.radians(angle)) |
Polar to Cartesian x |
Learning Check¶
Your Turn — Change the Ring Size
What happens if you change radius = 150 to radius = 80?
Predict whether the spirals will overlap — then run it to check!
With radius = 80 the spirals overlap significantly in the center — the smaller ring packs them tighter than the spirals' own size, creating a dense, tangled core.
Experiments¶
-
Try 6 spirals. Change
range(12)torange(6)andi * 30toi * 60. You'll know it worked when only six spirals appear, spaced further apart. -
Make all spirals the same color. Remove the
colorsparameter and hard-codemonty.color('navy'). You'll know it worked when all spirals are the same deep blue. -
Face inward. Change
mini_spiral(x, y, angle, ...)tomini_spiral(x, y, angle + 180, ...). Each spiral now faces toward the center. You'll know it worked when the spirals grow inward instead of outward. -
Use hexagonal mini-spirals. Change
right(90)insidemini_spiraltoright(60). You'll know it worked when each small spiral has hexagonal corners.
Meta-Spirals!
You arranged micro-patterns into a macro-pattern using the same circle math
from the pinwheel. This "pattern of patterns" idea is a core concept in fractal design!
Up next: Color-Banded Pentagon Spiral — the last spiral in this category.