@tempots/std

interpolateAngleCCW() function

Interpolates values in a polar coordinate system always in counter-clock-wise direction.

Signature:

interpolateAngleCCW: (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

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