32
loading...
This website collects cookies to deliver better user experience
Pentagram | Star of David |
---|---|
![]() |
![]() |
Heptagram | Octagram |
---|---|
![]() |
![]() |
A complex polygon | A complex polygon of star shape |
---|---|
![]() |
![]() |
Regular octagram | Degenerate octagram |
---|---|
![]() |
![]() |
Method 1 | Method 2 | Method 3 |
---|---|---|
![]() |
![]() |
![]() |
1 vertex skipped | 2 vertices skiped | 3 vertices skipped |
For a star with N
vertices you can draw abs(N/2)-1
stars
For example for a star with 9 vertices you can only draw
abs(9/2)-1=3
stars
The order of a star M
can be defined as the number of vertices skipped +1
.
So the possible orders for a 9-vertex star are 2, 3 and 4 for 1, 2 and 3 vertices skipped respectively
If N
is divisible by M
, the star is degenerate
M
360*M
N
vertices each exterior angle = 360*M/N
import turtle as t
LENGTH=500
def regular_star(n,m):
"""Draws a regular star polygon (not a degenerate one)
n = number of pointies
m = number of points to skip
"""
angle = 360*m/n
for count in range(n):
t.forward(LENGTH)
t.right(angle)
t.hideturtle()
t.pensize(2)
t.color("green")
regular_star(103,51)