TPS_unif_core
TPS_rect_core

Synopsis

Generates uniform and rectilinear grids using Thin Plate Spline.


   module TPS_unif_core<src_file="tps_unif.cpp"> {
      cxxmethod+notify_inst+req update(
         coord+read+notify+req,
         values+read+notify+req,
         smooth+read+notify+req,
	      dims+read+notify+req,
	      out+write,
   	   points+write
      );
      float+IPort2 coord[];
      float+IPort2 values[];
      TPS_Params+IPort2 &TPS_Params;
      float smooth => <-.TPS_Params.smooth;
      int  dims[2] => <-.TPS_Params.dims;
      float+OPort2 points[4];
      float+OPort2 out[prod(dims)];
   };

   module TPS_rect_core<src_file="tps_rect.cpp"> {
      cxxmethod+notify_inst+req update(
         coord+read+notify+req,
         values+read+notify+req,
         smooth+read+notify+req,
         add_points+read+notify+req,
         dims+write,
         points+write,
         out+write
      );
      float+IPort2 coord[];
      float+IPort2 values[];
      TPS_Params+IPort2 &TPS_Params;
      float smooth => <-.TPS_Params.smooth;
      int   add_points => <-.TPS_Params.add_points;
      int+OPort2   dims[2];
      float+OPort2 points[sum(dims)][2];
      float+OPort2 out[prod(dims)];
   };

Description

The TPS_unif_core and TPS_rect_core modules use the Thin Plate Spline algorithm to generate uniform and rectilinear output grids 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 output grid is represented as a number of arrays of data. These can be input into the appropriate field mapper to generate uniform or rectilinear fields. This is done in the Functional macros TPS_unif and TPS_rect. In most cases it will be easier to use these macros than it will be to use these modules directly.

Inputs

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.

&TPS_Params

Reference to the parameter block, which contains real instances of the smoothness and dimensioning variables.

smooth

Reference to the 'smoothness' variable of type float, via the parameter block, which is referenced by the &TPS_Params input. The smoothness value specifies now smooth the resultant surface should be. If the smoothness is set to zero then in a rectilinear grid output points will be present at all of the input points.

dims[2]

Reference to the dims array of type int, via the parameter block, which is referenced by the &TPS_Params input. This parameter is used by the TPS_unif_core module and specifies the x and y dimensions that the resultant uniform grid should have. It is not used by the TPS_rect_core module.

add_points

Reference to the add_points variable of type int, via the parameter block, which is referenced by the &TPS_Params input. This parameter is used by the TPS_rect_core module and specifies how many points should be added in between each of the input points. Increasing this value will improve the accuracy of the resultant mesh. It is not used by the TPS_unif_core module.

Outputs

dims[2]

Dimensions of output rectilinear grid. This output is not used by the TPS_unif_core module.

points[...][2]

Location of output grid in space. The TPS_unif_core outputs the coordinates of the extreme points of the uniform grid. The TPS_rect_core outputs the coordinates of the origin of each grid line in the rectilinear mesh.

out[]

Values of each node on the output grid. The values are calculated by using the Thin Plate Spline algorithm to interpolate between each input point.

Utility Macros

The low-level TPS_unif_core module is used in the Functional Macro TPS_unif and the User Macro tps_unif. The low-level TPS_rect_core module is used in the Functional Macro TPS_rect and the User Macro tps_rect. Additionally, these macros also use the TPS_Params parameter block group, as do the UI macros.

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_mods.v contains the V definitions of the TPS_Params group and the TPS_unif_core and TPS_rect_core modules.

Other Notes

The low-level ThinPlateSplineMods library containing the modules TPS_unif_core and TPS_rect_core, does not specify a process. By default the express process will be used.

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.