Modify circle of isosceles triangle projects to make all triangles point inward as shown.
Related Projects:
Modify circle of isosceles triangle projects to make all triangles point inward as shown.
Related Projects:
Use the Isosceles triangle function created in this project, draw the circle of isosceles triangles as shown below. Your code should easily change the number of triangles, and radius and height of the triangles.
Source Code:
from turtle import *
import math
import random
title('Isosceles Triangle Circle - PythonTurtle.Academy')
setup(1000,1000)
setworldcoordinates(-500,-500,500,500)
hideturtle()
tracer(0,0)
# x,y is the center of the base, width: length of base, height: height of triangle from the top to base
# direction:direction from the center of base to top
def IsoscelesTriangle(x,y,width,height,direction,c):
up()
goto(x,y)
seth(direction-90)
fd(width/2)
p1x, p1y = xcor(), ycor() # first point: bottom right
back(width)
p2x, p2y = xcor(), ycor() # second point: bottom left
goto(x,y)
seth(direction)
fd(height)
p3x, p3y = xcor(), ycor() # third point: top
goto(p1x,p1y)
down()
fillcolor(c)
begin_fill()
goto(p2x,p2y)
goto(p3x,p3y)
goto(p1x,p1y)
end_fill()
n=12
r=300
width=2*r*math.sin(math.radians(180/n))
height=200
for i in range(n):
IsoscelesTriangle(r*math.cos(math.radians(180/n))*math.cos(math.radians(i*360/n)),
r*math.cos(math.radians(180/n))*math.sin(math.radians(i*360/n)),width,height,i*360/n,'blue')
update()
Related Projects:
Use Python and Turtle and Random library to draw the 50 random isosceles triangles as shown in the following figure.
Hints:
Source Code:
from turtle import *
import math
import random
title('Isosceles Triangle Madness - PythonTurtle.Academy')
setup(1000,1000)
setworldcoordinates(-500,-500,500,500)
hideturtle()
tracer(0,0)
# x,y is the center of the base, width: length of base, height: height of triangle from the top to base
# direction:direction from the center of base to top
def IsoscelesTriangle(x,y,width,height,direction,c):
up()
goto(x,y)
seth(direction-90)
fd(width/2)
p1x, p1y = xcor(), ycor() # first point: bottom right
back(width)
p2x, p2y = xcor(), ycor() # second point: bottom left
goto(x,y)
seth(direction)
fd(height)
p3x, p3y = xcor(), ycor() # third point: top
goto(p1x,p1y)
down()
fillcolor(c)
begin_fill()
goto(p2x,p2y)
goto(p3x,p3y)
goto(p1x,p1y)
end_fill()
for _ in range(50):
IsoscelesTriangle(random.uniform(-400,400),random.uniform(-400,400),
random.uniform(30,300), random.uniform(30,300),
random.uniform(0,360),
(random.uniform(0,1),random.uniform(0,1),random.uniform(0,1)))
update()
Draw the 50 random isosceles trapezoids with random locations, random sizes, and random filled colors.
Hints:
We draw a basic Trefoil shape in this project. Can you draw two Trefoils shapes to form a ring? All tricks are okay as long as they work!
Draw a sun shape with a circle and evenly space isosceles triangles surrounding the circle. You may need to use trigonometry to draw this shape. You can also color the circle and the triangles.
A complete bipartite graph is a graph with two sets of vertices where there is no edge between vertices belonging to the same set; but all vertices of different sets are fully connected. Draw the K(10,10) where each set have 10 vertices.
Although both orange circles have the same size, one appears to be bigger than the other.
Impossible Trident also known as Impossible Fork is an impossible shape. For more information about this shape check out this Wikipedia article.
Animate the Kanizsa Triangle with expanding and shrinking illusionary triangle.