I am trying to define a function that draws a triangle of a given size using the turn method. I've never used turtle graphics before and am not sure how to go about this.
Thank you
jozz3 0 Light Poster
Recommended Answers
Jump to PostIn simple terms, to form the triangle you can draw 3 lines of the same length. To connect the lines, you turn the turtle by 360/3 = 120 degrees after each line has been drawn.
Example ...
import turtle as tu tu.forward(200) tu.right(120) tu.forward(200) tu.right(120) tu.forward(200) …
Jump to PostIf you want to draw a triangle knowing only it's three unequal sides, then things get a bit more complex. You have to apply the law of sines, which states that the ratio of the length of a side to the sine of its corresponding opposite angle is constant.
All 6 Replies
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
jozz3 0 Light Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.