I am following a youtube series that demonstrates how to code the classic video game "Asteroids". Part of the program allows the user to generate a equilateral triangle procedurally to serve as the players ship given an angle such as 90 degrees, and the length measurement of the side.

But I am not certain how the program is able to use vectors generated from the formulas to actually draw the triangle.

It has been awhile since I have done trig, but I still remember basics of trigonometry such as the SOH CAH TOA ratios, unit circle, solving for lengths or angles of a missing side. For all the formulas noted, it would take a side measurement for example 15px, and multiply that by the vector for example cos(90), sin(90) becomes 15*cos(90), 15*sin(90).

Here are the formulas used, and an example of the program output to generate the triangle using these formulas.

Many thanks.