Skip to main content
Skip table of contents

(v13) The interpop operator

This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP

internaldict real array interpop real

Implements a simple y(x) function using linear interpolation of a table.

The real operand should be a real value between 0 and 1 ; if the value is outside this range, it is clipped. This number is the x value input to the function.

The array operand must be an array of numbers; each value may be an integer or a real. There is no restriction on the values of the numbers or the number of entries in the array (except for PostScript limits). The array is treated as a table of y values along a linearly-spaced x axis of the y(x) function. The first value is for x =0 and the last value is for x =1 .

The returned real value is the value of y(x) obtained by linearly interpolating between the appropriate segment of the table.

A simple example follows:

userdict /interpop 1183615869 internaldict /interpop get put 0.7 {0 0.15 0.45 0.65 0.85 1} //interpop

with the result of 0.75 . There are six values in the table spaced by x of 0.2 ; with x =0.7 , the segment is between x =0.6 and x =0.8 . These have values of y =0.65 and y =0.85 respectively with the result of 0.75 , which is 50% along that segment.

For other examples, see Simple example .

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.