interpolate::scatter
Scattered data in any dimension: a k-d tree, robust predicates, the 2-d Delaunay triangulation, and interpolants on top of them.
Modules
delaunayThe 2-d Delaunay triangulation by a radial sweep and edge flips (Mapbox's Delaunator, after Sinclair's S-hull): seed with the smallest circumcircle near the center, add the points by distance from it, each to the visible part of the convex hull, and flip every new edge that fails the empty-circle test.kdtreeA k-d tree over points in any dimension (Bentley 1975): median splits on the widest axis found by quickselect, leaf buckets, and branch-and-bound queries that visit the nearer child first and skip a far child once its splitting plane is farther than the current k-th neighbor.linearInterpolants of scattered data: piecewise linear on the Delaunay triangulation (2-d) and nearest neighbor through a k-d tree (any d).predicatesRobust geometric predicates after Shewchuk, "Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates" (1997): a floating-point evaluation with a forward error bound, and when the bound does not settle the sign, the exact value as a nonoverlapping expansion (two_sum / two_product, Dekker splitting, no FMA), whose last component carries the sign.rbfRadial basis function interpolation (Fasshauer, "Meshfree Approximation Methods with MATLAB", 2007): s(x) = sum_i c_i phi(eps |x - x_i|) + p(x) with p a polynomial of low degree, the coefficients from the saddle-point system [K + lambda I, P; P^T, 0] [c; d] = [y; 0] solved by LU with partial pivoting.
Re-exports
delaunay::DelaunaySource
pub use delaunay::DelaunayDelaunayA Delaunay triangulation of points in the plane: no point lies strictly inside the circumcircle of any triangle.
kdtree::{KdTree, Neighbors}Source
pub use kdtree::{KdTree, Neighbors}linear::{LinearND, Method, NearestND, griddata}Source
pub use linear::{LinearND, Method, NearestND, griddata}LinearNDPiecewise-linear interpolation of 2-d scattered data: inside each Delaunay triangle the plane through its three values (barycentric weights), so linear functions come back exactly (to rounding).MethodHowgriddatainterpolates.NearestNDNearest-neighbor interpolation in any dimension: the value of the closest data point (the lowest row among equally close ones), found with a k-d tree.griddataThe datavaluesatpoints(n x d) interpolated at the rows ofxi(m x d), in one call:LinearND(NaN outside the hull) orNearestND.
predicates::{incircle, orient2d}Source
pub use predicates::{incircle, orient2d}incirclePositive whendlies inside the circle througha b c(taken counterclockwise; the sign flips for a clockwise triangle), negative outside, zero exactly when the four points are cocircular.orient2dTwice the signed area of the trianglea b c: positive when the points turn counterclockwise, negative clockwise, zero exactly when they are collinear.
rbf::{Kernel, Rbf}Source
pub use rbf::{Kernel, Rbf}