pythonmathturtle-graphicspython-turtleangle

Determining the angle in python turtle graphics


The task is to draw an equilateral triangle that will be positioned in the first quadrant, so that it is symmetrical with respect to the bisector of the first and third quadrants. Image of triangle

How would i determine the initial angle that i need to turn.


Solution

  • The y = x forms a 45-degree angle with the x-axis, an equilateral triangle has internal angles of 60 degrees by definition.
    Because the triangle is symmetrical on the y = x line, the angle formed between the y = x line and the triangle would be 30 degrees. Now we just calculate 45 - 30 = 15, so we have a 15-degree angle to the x-axis and the triangle.