SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
mesh::NaturalNeighbourInterpolator Class Reference

#include <naturalnbinterpolator.h>

Collaboration diagram for mesh::NaturalNeighbourInterpolator:

Public Types

enum class  Variant {
  Sibson ,
  Laplace
}
 

Public Member Functions

 NaturalNeighbourInterpolator ()=default
 
void setVariant (Variant v)
 
Variant variant () const
 
bool build (const QVector< QPointF > &pts, const QVector< double > &z, QString *err)
 Triangulate the seed set. Snap-dedupes coincident points, requires >= 3 unique non-collinear points. Returns false (and sets *err when non-null) when interpolation is unavailable — the caller should then fall back to IDW entirely.
 
bool build (const QVector< QPointF > &pts, QString *err)
 Triangulate seeds for weight queries only (weightsAt), with no associated values. Equivalent to build() with a zero z vector.
 
bool isValid () const
 
double interpolate (double x, double y) const
 Interpolate z at (x, y). Returns NaN when the point is outside the seed convex hull or the local insertion is degenerate — the caller falls back to IDW for that vertex.
 
bool weightsAt (double x, double y, QVector< QPair< int, double > > &out) const
 Natural-neighbour weights at (x, y), keyed by ORIGINAL seed index.
 
const std::vector< int > & keptSeedIndices () const
 Original indices of the seeds that survived snap-dedupe, in Delaunay-vertex order. Coincident inputs collapse to the first occurrence, so a caller can diff this against its input to learn which seeds were dropped and will never carry weight.
 

Member Enumeration Documentation

◆ Variant

Enumerator
Sibson 
Laplace 

Constructor & Destructor Documentation

◆ NaturalNeighbourInterpolator()

mesh::NaturalNeighbourInterpolator::NaturalNeighbourInterpolator ( )
default

Member Function Documentation

◆ build() [1/2]

bool mesh::NaturalNeighbourInterpolator::build ( const QVector< QPointF > &  pts,
const QVector< double > &  z,
QString *  err 
)

Triangulate the seed set. Snap-dedupes coincident points, requires >= 3 unique non-collinear points. Returns false (and sets *err when non-null) when interpolation is unavailable — the caller should then fall back to IDW entirely.

Here is the caller graph for this function:

◆ build() [2/2]

bool mesh::NaturalNeighbourInterpolator::build ( const QVector< QPointF > &  pts,
QString *  err 
)

Triangulate seeds for weight queries only (weightsAt), with no associated values. Equivalent to build() with a zero z vector.

Here is the call graph for this function:

◆ interpolate()

double mesh::NaturalNeighbourInterpolator::interpolate ( double  x,
double  y 
) const

Interpolate z at (x, y). Returns NaN when the point is outside the seed convex hull or the local insertion is degenerate — the caller falls back to IDW for that vertex.

◆ isValid()

bool mesh::NaturalNeighbourInterpolator::isValid ( ) const
inline

◆ keptSeedIndices()

const std::vector< int > & mesh::NaturalNeighbourInterpolator::keptSeedIndices ( ) const
inline

Original indices of the seeds that survived snap-dedupe, in Delaunay-vertex order. Coincident inputs collapse to the first occurrence, so a caller can diff this against its input to learn which seeds were dropped and will never carry weight.

◆ setVariant()

void mesh::NaturalNeighbourInterpolator::setVariant ( Variant  v)
inline

◆ variant()

Variant mesh::NaturalNeighbourInterpolator::variant ( ) const
inline

◆ weightsAt()

bool mesh::NaturalNeighbourInterpolator::weightsAt ( double  x,
double  y,
QVector< QPair< int, double > > &  out 
) const

Natural-neighbour weights at (x, y), keyed by ORIGINAL seed index.

Same scheme interpolate() uses; this exposes the coordinates themselves so a caller can blend something other than a scalar z (e.g. whole rainfall time series). Weights are normalised to sum 1 and returned SORTED ASCENDING BY INDEX — the order is contractual, because the underlying accumulation walks a QHash whose iteration order is randomised per process, and callers that hash these weights need reproducibility.

Parameters
outReceives (original seed index, weight) pairs; cleared first.
Returns
false — with out empty — when the query is outside the hull or the local insertion is degenerate, exactly where interpolate() would return NaN. The caller falls back to IDW.
Note
Not thread-safe for concurrent queries: inherits interpolate()'s mutable walk-start cache. Use one instance per worker thread.

The documentation for this class was generated from the following files: