@tempots/std

interpolateAngleCW() function

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

Signature:

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

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