tps_unif
tps_rect

Synopsis

Generates uniform and rectilinear fields using Thin Plate Spline.

Input Ports

Name Type Description

coord float[...][2] locations of 2D input points
values float[...] values of input points

Parameters

Name Type Description UI Control

smooth float 'smoothness' of resultant field UIslider
dims int[2] dimensions of uniform field X & Y UIsliders
add_points int number of interpolated points UIslider

Output Ports

Name Type Description

out_fld Field uniform or rectilinear output field
out_obj DataObject directly renderable output object

Description

The tps_unif and tps_rect macro use the Thin Plate Spline algorithm to generate 2D uniform and rectilinear fields from a set of points and values. The interpolation calculated by the Thin Plate Spline algorithm passes exactly through all the input points. However the output grid only respects the input points in the case of a rectilinear grid with a 'smoothness' of 0. The tps_unif macro generates a uniform output field while the tps_rect macro generates a rectilinear output field. A user interface is provided that allows the 'smoothness' and detail of the resultant field data to be specified.

Input Ports

coord[..][2]

Coordinates of the points that are to be used to generate the resulting grid. This float array should consist of a series of x,y coordinate pairs. It is not possible to use 3D coordinates. If a rectilinear grid is being generated and the smoothness is set to zero then output points will be present at all of these coordinates.

values[..]

Value of the input variable at the input coordinates. This float array should match the coordinate input array.

Parameters

smooth

A member of the TPS_Params parameter block group, this float value is used to specify the 'smoothness' of the resulting surface. If the smoothness is set to zero then in a rectilinear field output nodes will be present at all of the input points.

dims[2]

A member of the TPS_Params parameter block group, this int array is used by the tps_unif macro to specify the x and y dimensions of the resultant uniform grid. It is not used by the tps_rect macro.

add_points

A member of the TPS_Params parameter block group, this int value is used by the tps_rect macro to specify how many points should be added in between each of the input points. Increasing this value will improve the accuracy of the resultant field. It is not used by the tps_unif macro.

Output Ports

out_fld

The output field of the tps_unif and tps_rect macros. This contains the interpolated grid generated from the input points and values by the Thin Plate Spline algorithm. The data is represented as a AVS field. The tps_unif macro generates a uniform output field, while the tps_rect macro generates a rectilinear output field.

out_obj

The directly renderable output of the tps_unif and tps_rect macros. This contains a DataObject object that can be rendered by the standard data viewers. The output object will contain a uniform or rectilinear field as appropriate.

Utility Macros

The User Macro tps_unif combines the Functional Macro TPS_unif with the UI Macro TPS_unifUI. The User Macro tps_rect combines the Functional Macro TPS_rect with the UI Macro TPS_rectUI. Both of the user macros also make use of the common parameter block TPS_Params to tie the Functional Macro and UI macro together.

Example

Two example applications are provided, TPS_uniform_Eg and TPS_rectilinear_Eg which generate uniform and rectilinear grids from a set of points. In both cases the grid is then converted into a field and expanded into 3 dimensions by using the surf_plot module. This is done to make the effect of the Thin Plate Spline easier to see.

Files

iac_proj/tpspline/tps_macs.v contains the V definitions of the Functional Macros TPS_unif and TPS_rect, the User Macros tps_unif and tps_rect, the UI Macros TPS_unifUI and TPS_rectUI and the Example Applications TPS_uniform_Eg and TPS_rectilinear_Eg. It also contains two base objects, TPS_baseUI and TPS_base_Eg.

Other Notes

The ThinPlateSplineMacs library inherits its process. As this library contains no procedural code, the process is not important. The modules in the low-level ThinPlateSpline library execute under the process specified in that library, not the process defined in the high-level library.

The Thin Plate Spline implementation is based upon the code written by Dave Eberly. More information can be found on the Magic Software home page. The original code can be found on the interpolation page.

Author

Mario Valle

Modifications

Andrew Dodd

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also

TPS_Params, TPS_unif, TPS_rect, tps_unif, tps_rect, TPS_baseUI, TPS_unifUI, TPS_rectUI, TPS_baseEg, TPS_uniform_Eg, TPS_rectilinear_Eg.