@sample(nim, n:integer)


build a new nim with linear interpolation type by sampling each component with n points equally spaced between the first and the last breakpoint.

The result is a nim with linear interpolation type for all component, irrespectively of the interpolation type of the nim argument. The resulting nim can be seen as a linear approximation of the original curve.

The sampling is made component by components, so the results is not necessarily homogeneous. The function @align_breakpoints can be used on a nim with linear interpolation type to obtain an equivalent nim with homogeneous breakpoints

The approximation made with sampling on n points is not always satisfactory because the variation of the nim can differ greatly between two intervals. The function @linearize uses an adaptive sampling step to linearize the nim, to align the breakpoints and to achieve an approximation within a given tolerance .

In the figure below, the diagram at the top left shows a vectorial nim with two components:

• the effect of @sample is pictured at top right,

• the effect of @align_breakpoints is sketched at bottom left,

• and the effect of @linearize is illustrated at bottom right.