Index of OpenRM - RMV Library


 void rmv2DSurfaceFit (float *x,
	     	       float *y,
		       float *d,
		       int npts,
		       RMvertex2D *omin,
		       RMvertex2D *omax,
		       int usize,
		       int vsize,
		       int method,
		       float tweak,
		       float *newdata)
 float *x, *y - arrays of float of (x, y) points.
 float *d - an array of float of scalar values associated with the 
    grid points (input).
 int npts - int specifying the number of points to fit (input).
 RMvertex2D *omin, *omax - handles to the extents of the grid to fit
    (input).
 int usize, vsize - int specifying the grid resolution for the fitted
    surface (input).
 int method - an integer indicating the method of surface fitting to
    use.  Must be one of RMV_GRID2D_BIVARIATE, RMV_GRID2D_IDSFFT, or
    RMV_GRID2D_KRIGE (input).
 float tweak - a float specifying the neighborhood size for computing
    partial derivatives (input).
 float *newdata - a handle to an array of float of size (usize *
    vsize) for the computed surface points (modified). 

Fits a surface to scattered points by three different approaches, selected by the method parameter. This routine is naturally understood as surface fitting for height fields.

For RMV_GRID2D_BIVARIATE surface fitting, a Delauney triangulation of the points in the plane, then compute partial derivatives of surface slope at each point. These partials are used to construct the fitted surface, but can be numerically sensitive. When smaple points are less evenly distributed, this method may produce better results. However, the nature of the partial derivatives can yield computed surface points that vary wildly from the input points.

For RMV_GRID2D_IDSFFT surface fitting, a frequency-space FFT method is used.

For RMV_GRID2D_KRIGE surface fitting, an inverse-squared-distance operation is used in a specified neighborhood of the sample points to compute an averaged surface. The number of points to use for the neighborhood computation is set by the tweak parameter. There is a trade-off in terms of speed of fitting versus the smoothness of fit, which is a function of the size of the neighborhood used for the averaging. Thus, this method works well when sample points are relatively evenly distributed.

No status is currently returned to the caller.

librmv library source file: rmvgrid2d.c