packages

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

  • delaunay The 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.
  • kdtree A 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.
  • linear Interpolants of scattered data: piecewise linear on the Delaunay triangulation (2-d) and nearest neighbor through a k-d tree (any d).
  • predicates Robust 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.
  • rbf Radial 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::Delaunay
  • Delaunay A 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}
  • KdTree A k-d tree over the rows of an n x d matrix.
  • Neighbors The k nearest neighbors of a point: their row indices into the tree's points and their Euclidean distances, nearest first.

linear::{LinearND, Method, NearestND, griddata}Source

pub use linear::{LinearND, Method, NearestND, griddata}
  • LinearND Piecewise-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).
  • Method How griddata interpolates.
  • NearestND Nearest-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.
  • griddata The data values at points (n x d) interpolated at the rows of xi (m x d), in one call: LinearND (NaN outside the hull) or NearestND.

predicates::{incircle, orient2d}Source

pub use predicates::{incircle, orient2d}
  • incircle Positive when d lies inside the circle through a b c (taken counterclockwise; the sign flips for a clockwise triangle), negative outside, zero exactly when the four points are cocircular.
  • orient2d Twice the signed area of the triangle a 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}
  • Kernel The radial function phi(r) of an Rbf, applied to eps * r.
  • Rbf A radial basis function interpolant of scattered data in any dimension.