Loading...
Searching...
No Matches
naturalnbinterpolator.h File Reference

Natural-neighbour interpolation over a sparse set of scattered seed points (x, y, z). More...

#include <QPair>
#include <QPointF>
#include <QString>
#include <QVector>
#include <utility>
#include <vector>
Include dependency graph for naturalnbinterpolator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mesh::NaturalNeighbourInterpolator
 Natural-neighbour (Sibson or Laplace) interpolator over scattered (x, y, z) seeds. More...
 

Namespaces

namespace  mesh
 The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and cell attributes, the mesh generator, quad regions, matching and cleanup, mesh statistics, and the INP and 2DM mesh codecs.
 

Detailed Description

Natural-neighbour interpolation over a sparse set of scattered seed points (x, y, z).

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License
Apache-2.0

Natural-neighbour interpolation over a sparse set of scattered seed points (x, y, z). Used as an alternative to inverse-distance weighting for the no-DTM elevation fallback in the mesh generator: when no terrain raster is supplied, mesh-vertex z is interpolated from SWMM junction rim elevations and 3D feature-Z seeds.

The seeds are triangulated once with the in-house Delaunay kernel (mesh/meshcdt.h) (the same vendored library the MeshGenerator uses) to obtain a Delaunay triangulation + neighbour adjacency. Each query then performs a local insertion (Watson's method) to recover the natural neighbours of the query point and their weights:

Sibson — area-stealing coordinates: weight_i = (Voronoi area the query cell steals from neighbour i) / (total stolen area). C1-smooth. Laplace — non-Sibsonian "edge" coordinates: weight_i = (length of the Voronoi facet between query and neighbour i) / ||query - p_i||.

Natural-neighbour interpolation is only defined inside the convex hull of the seeds. interpolate() returns NaN outside the hull and on any degeneracy so the caller can fall back to IDW.

Thread-safety: interpolate() mutates a walk-start cache (m_lastTri), so a single instance is NOT safe for concurrent queries. It is, however, safe to build and query off the GUI thread (no Qt-widget access) — which is how the QtConcurrent mesh worker uses it, sequentially.