@tempots/std

widestAngleDifference() function

Calculates the widest angle difference between two angles.

Signature:

widestAngleDifference: (a: number, b: number, turn?: number) => number

Parameters

Parameter

Type

Description

a

number

The first angle in degrees.

b

number

The second angle in degrees.

turn

number

(Optional) The total angle of a full turn. Defaults to 360 degrees.

Returns: number

The widest angle difference between a and b.

Example

widestAngleDifference(0, 90) // returns 90
widestAngleDifference(90, 0) // returns -90
widestAngleDifference(0, 270) // returns -90
widestAngleDifference(270, 0) // returns 90