Spline2D (FPScript)

21.09.2021

Interpolates a two-dimensional data set through a grid of spline curves and samples these curves at definable points.

Syntax

Spline2D(Surface, NX, NZ, SamplingMode, [ VX1 = 0 ], [ VXn = 0 ], [ VZ1 = 0 ] [ , VZn = 0 ])
or
Spline2D(DataMatrix, LocusX, LocusZ, NX, NZ, SamplingMode, [ VX1 = 0 ], [ VXn = 0 ], [ VZ1 = 0 ] [ , VZn = 0 ])

 

The syntax of the Spline2D function consists of the following parts:

Part

Description

Surface

The data matrix or signal series with a Z component and a constant sampling interval, which is interpolated. If the X and Z components are missing, they will be generated automatically.

Permitted data structures are data matrix und signal series. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

DataMatrix

Data matrix with the Y component of the signal series to be interpolated. If you specify a signal series, then its Y component is used.

Permitted data structures are data matrix und signal series. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

LocusX

Data series with the X component of the signal series to be interpolated. If you specify a signal, then its Y component is used.

Permitted data structures are data series und signal. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

LocusZ

Data series with the Z component of the signal series to be interpolated. If you specify a signal, then its Y component is used.

Permitted data structures are data series und signal. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

NX

Specifies the total number of points or per X interval of the signal.

Permitted data structures are scalar value. All integral data types are permitted.

The value must be greater or equal to 0.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

NZ

Specifies the total number of points or per Z interval of the signal.

Permitted data structures are scalar value. All integral data types are permitted.

The value must be greater or equal to 0.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

SamplingMode

Specifies how the calculated spline curve is to be sampled and which boundary conditions are used.

The argument SamplingMode can have the following values:

Constant

Meaning

SPLINE_EQUIDISTANT

N values equidistantly sampled.

SPLINE_INTERVAL

N values per original X interval. The number of values of the result is (NumberOfRows(DataSet) - 1) * N + 1.

...plus a constant, which determines the boundary conditions.

Constant

Meaning

+ SPLINE_NOTAKNOT

Not-A-Knot boundary condition (VX1, VZ1, VXn and VZn are ignored).

+ SPLINE_1DERIVATIVE

VX1, VZ1, VXn and VZn are interpreted as a gradient (1st derivative) in the first and last point in the X or Z direction.

+ SPLINE_2DERIVATIVE

VX1, VZ1, VXn and VZn are interpreted as a curvature (2nd derivative) in the first and last point in the X or Z direction.

+ SPLINE_3DERIVATIVE

VX1, VZ1, VXn and VZn are interpreted as the third derivative in the first and last point in the X or Z direction.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

VX1

Determines the boundary condition at the left edge.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

VXn

Determines the boundary condition at the right edge.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

VZ1

Determines the boundary condition at the back edge.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

VZn

Determines the boundary condition at the front edge.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

Remarks

The result always has the data type 64-bit floating point.

First, for each row of the grid spanned by the Y component of the data set, a spline curve is modeled and evaluated at the desired Z positions. This type of spline curve consists of cubic polynomials, which are appended to one another to provide the smoothest course possible. Then, for each column of the data matrix calculated this way, a spline curve is modeled and evaluated at the desired X positions. Before every spline interpolation, void values in rows or columns are eliminated by linear interpolation. The Y component of the data set to be interpolated must contain at least 3 x 3 values and the X and Z components must be strictly increasing.

You obtain a natural spline curve with V1 and Vn as second derivatives equal to zero.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Dim data = {{0, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 0}}
Spline2D(data, 100, 100, SPLINE_EQUIDISTANT + SPLINE_NOTAKNOT)
 

Interpolates the matrix through a grid of spline curves without boundary conditions.

The following illustrations show a 2D spline curve and the data it is based on:

Spline2D(data, 100, 100, SPLINE_EQUIDISTANT + SPLINE_1DERIVATIVE, -10, 10, -10, 10)
 

Interpolates the matrix with boundary conditions. VX1, VZ1, VXn and VZn are interpreted as a gradient (1st derivative) in the first and last point in the X or Z direction.

See Also

Clip2D Function

Spline Function

CompensatingSpline Function

CompensatingSpline2D Function

ParametricSpline Function

PeriodicSpline Function

BicubicSpline Function

Spline Interpolation Analysis Object

Surface Interpolation Analysis Object

2D Approximation Analysis Object

References

[1] "Carl de Boor": "A Practical Guide to Splines, Revised Edition". "Springer-Verlag, New York",2001.ISBN 0-387-95366-3.

Share article or send as email:

You might be interested in these articles