miércoles, 15 de agosto de 2018

Some Polygonal Spirals

Polygonal Spirals

According with Oxford Advanced Genie Dictionary, a spiral is a shape or design, consisting of a continuous curved line that winds around a central point, with each curve further away from the centre.

In what follows there is a sample of spirals made of regular polygonal lines. Each one is associated with a regular polygon. As the number of sides increases it can be seen that the shape  tends to be a spiral in the sense of above definition.

In what follows some polygonal spirals are drawn using logo programs in Python 3.7 language. This program must be previously installed.


Triangular Spiral


# triang-spiral

from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+4*i),lt(120)
Terminator


Square Spiral

# sqr-spiral
from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+4*i),lt(90)
Terminator


Pentagon Spiral

#pent-spiral
from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+4*i),lt(72)
Terminator






Hexagon Spiral

# hex-spiral
from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+4*i),lt(60)
Terminator






Octagon Spiral

# octo-spiral
from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+4*i),lt(45)
Terminator







Decagon Spiral

# deca-spiral
from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+4*i),lt(36)
Terminator







20 Spiral

(From a regular 20 sides polygon)

# 20-spiral
from turtle import*
mode('logo')

for i in range(0, 30):     
    fd(10+i),lt(18)
Terminator




30 Spiral 

(From a regular 30 sides polygon)

# 30-spiral
from turtle import*
mode('logo')

for i in range(0, 50):     
    fd(5+.5*i),lt(12)
Terminator






The following program can be used to resume the above programs, giving particular values for 'n'

As it can be seen, the numbers 'k' in 'range(0, k)'  can be changed to obtain different sizes.

# poly-siyral
from turtle import*
mode('logo')
#n={3,4,5,8,9,10,12,20}

def polyspiral(n):
    for i in range(0, 30):   
        fd(10+4*i)
        lt(360//n)
#Replace 'n' in the following for a particular value
polyspiral(n)
             
Terminator