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)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.