Skip to content

bt-maths

[module] bt-maths

Mathematical helper procedures.

[procedure] (scale-values FIELD-VALUES AMIN AMAX)

Scale the list of FIELD-VALUES to fill the integer range AMIN,AMAX. See also fit-to-range.

[procedure] (fit-to-range FIELD-VALUES AMIN AMAX)

Scale down the list of FIELD-VALUES so that its contents fit into the range AMIN,AMAX. Unlike scale-values, this only scales down so that all values fit into the range, it does not increase spread, eg:

(scale-values '(63 64) 0 63) => '(0 63) (fit-to-range '(64 64) 0 63) => '(62 63)

[procedure] (interpolate VALS #!optional (TYPE 'linear))

Interpolate the list of integer values VALS. The input list may contain null values. By default, linear interpolation is used. This may be overridden by specifying TYPE. Currently, the only other available interpolation type is cosine.