@tempots/std

interpolateWidestAngle() function

Interpolates values in a polar coordinate system looking for the wideset delta angle. It can be either clock-wise or counter-clock-wise.

Signature:

interpolateWidestAngle: (a: number, b: number, t: number, turn?: number) => number

Parameters

Parameter

Type

Description

a

number

The first angle in degrees.

b

number

The second angle in degrees.

t

number

The interpolation value.

turn

number

(Optional) The total number of degrees in a full turn. Default is 360.0.

Returns: number

The interpolated angle.

Example

interpolateWidestAngle(0, 90, 0.5) // returns 45
interpolateWidestAngle(0, 270, 0.5) // returns 315
interpolateWidestAngle(0, 90, 0.25) // returns 22.5
interpolateWidestAngle(0, 270, 0.25) // returns 337.5