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
CellSurfaceInterp Namespace Reference

Functions

double depthAt (const QPointF &p, const QPointF &a, const QPointF &b, const QPointF &c, double z0, double z1, double z2, double sd0, double sd1, double sd2, bool *degenerate=nullptr)
 Water depth at p inside the triangle (a,b,c).
 

Function Documentation

◆ depthAt()

double CellSurfaceInterp::depthAt ( const QPointF &  p,
const QPointF &  a,
const QPointF &  b,
const QPointF &  c,
double  z0,
double  z1,
double  z2,
double  sd0,
double  sd1,
double  sd2,
bool *  degenerate = nullptr 
)
inline

Water depth at p inside the triangle (a,b,c).

Parameters
pSample point (scene space).
a,b,cTriangle corner positions (scene space).
z0,z1,z2Corner bed elevations, in corner order a,b,c.
sd0,sd1,sd2Corner SIGNED depths (η_k − z_k); exactly 0 == no data.
degenerateOptional out-flag: set true (with return 0) when the triangle is degenerate and barycentric weights are undefined — the caller falls back to its cell value.
Returns
depth ≥ 0; 0 when no corner carries a valid η (cell is dry).

Algorithm (plan + iteration 2 after visual review):

  1. barycentric weights (w,v,u) against (a,b,c) — identical construction to SWMM2DMeshLayer::sampleZAt so ground and depth share one basis;
  2. η_k = z_k + sd_k; a corner SUPPLIES surface only when WET (sd_k > 0); sd_k < 0 (η below that corner's own bed) and sd_k == 0 (no data) corners carry no water and are excluded from the blend AND the cap;
  3. nWet == 0 → 0 (dry) ; nWet == 3 → plain signed-depth blend (bit-identical to the pre-existing fully-wet path) ; else → weight-renormalized average of the wet corners' η (equals the plain lerp on an all-wet edge; holds level toward non-supplying corners — zero gradient in the dry direction);
  4. cap η at the max over WET corners (driving head — guards extrapolating weights at/outside the edge);
  5. return max(0, η − ground_interp).
Here is the caller graph for this function: