Skip to main content

Introduction to Angle Functions

In simple terms, trigonometry is the study of triangles. In programming, it is often used to determine the 2D coordinates of points which have been rotated a certain distance away from another point. You may have a mental image of a line being drawn from point A to point B, creating an angle. While calculating this angle is the objective we're trying to achieve, how we get there is by imagining not just a line, but a triangle instead--two flat lines following the X and Y axis like normal, while the angle is the triangle's hypotenuse.

Trigonometry demonstrates that it is possible to determine the position, orientation, and length of a triangle's hypotenuse based on its other two sides. While the formulae required are logically quite simple, actually calculating them is not. For programs that heavily rely on trigonometry, having an efficient way to perform these calculations is important. And for newcomers who may not yet be used to working with trigonometry in programming, making them easy to understand is equally so.

GML+ has many angle functions which fundamentally boil down to the same basic principles in different ways, allowing users to find which is easiest for their particular use-cases. In this section, we'll examine each one in detail.