Angles
Degrees and radians
In programming, radian is the preferred unit of angles. There are two functions for converting between the more conventional degree unit (0..360) and radian (0..2π)
Computing angle
From two Points
From a Line:
If you want to calculate angular movement from a stream of x,y values, consider the point tracker.
Shapes
Several shapes have functions that can work with angles.
- You can create an arc from an angle
- Rotate point around an origin
- Calculate angle between two points
- Rotate by angle
- Calculate angle of line
- Calculate interior angles
- Rotate triangle
- Determine kind of triangle based on angle relations (eg acute, obtuse…)
Arc
An arc is a range of angle. Think of it as a wedge-shaped slice of pizza. A larger arc would be a larger slice of pizza.
There are two functions to calculate the arc between a start and end angle: radianArc & degreeArc . These properly take into account the wrapping of angular values.
When calculating arcs, there are two possible answers depending on the direction of ‘travel’. By default the functions assume clockwise.
Summing
Because angles wrap around, basic math like adding them together can be a bit more complicated. Eg, if we have 350 degrees and add 20 degrees, the result ought to be 10.
Two functions assist in this: radiansSum & degreesSum . They take into account the wrapping of angles and allow you to specify what direction to add in (which allows for subtraction).