turtlecrystal.py

Created by ews31415

Created on December 14, 2021

474 Bytes

Draws a crystal consisting of four 60-80-100 triangles using the Turtle modules. The triangles are modeled after the 3-4-5 right triangle.


# 2021-12-14 ews
from math import *
from turtle import *

# angles for 3-4-5 triangle
# scaled by 2
# 60-80-100 triangle
a=degrees(asin(3/5))
b=degrees(asin(4/5))

# drawing
color(64,128,192)
pensize(2)
forward(80)
left(180-a)
forward(100)
left(180-b)
forward(60)

forward(60)
left(180-b)
forward(100)
left(180-a)
forward(80)

forward(80)
right(180-a)
forward(100)
right(180-b)
forward(60)

forward(60)
right(180-b)
forward(100)
right(180-a)
forward(80)