![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Classes | |
| struct | ClusterKey |
| A canonical, integer-valued summary of one weight vector. More... | |
Functions | |
| QVector< QPointF > | clipHalfPlane (const QVector< QPointF > &ring, const QPointF &keep, const QPointF &drop) |
Clip an open ring by the half-plane of points at least as close to keep as to drop. | |
| QVector< double > | thiessenAreaShares (const QVector< QPointF > &ring, const QVector< QPointF > &gages) |
Area of ring intersected with each gage's Voronoi cell. | |
| int | areaMajorityGage (const QVector< double > &shares, double *fractionOut=nullptr) |
| Index of the largest share, ties broken toward the lowest index. | |
| QVector< QPointF > | samplePolygon (const QVector< QPointF > &ring, int target=kDefaultSampleTarget) |
| Interior sample points for area-averaging a field over a ring. | |
| QVector< QPair< int, double > > | idwWeights (const QPointF &p, const QVector< QPointF > &sites) |
| Inverse-distance weights (power 2), normalised to sum 1. | |
| ClusterKey | quantizeWeights (const QVector< double > &w, double tol=kDefaultClusterTol, double wEps=kWeightEpsilon) |
| Quantise a dense weight vector into a canonical cluster key. | |
| QVector< double > | dequantizeWeights (const ClusterKey &key, double tol, int nGages) |
| Dense weights implied by a key — the blend actually synthesised. | |
Variables | |
| constexpr double | kWeightEpsilon = 1e-4 |
| Weights below this magnitude are clamped to zero before clustering. | |
| constexpr double | kDefaultClusterTol = 0.01 |
| Default weight-agreement tolerance for clustering (1%). | |
| constexpr int | kDefaultSampleTarget = 200 |
| Default number of interior samples requested per ring. | |
| int GageAssignment::areaMajorityGage | ( | const QVector< double > & | shares, |
| double * | fractionOut = nullptr |
||
| ) |
Index of the largest share, ties broken toward the lowest index.
| shares | As returned by thiessenAreaShares(). |
| fractionOut | When non-null, receives the winner's share of the total. |
| QVector< QPointF > GageAssignment::clipHalfPlane | ( | const QVector< QPointF > & | ring, |
| const QPointF & | keep, | ||
| const QPointF & | drop | ||
| ) |
Clip an open ring by the half-plane of points at least as close to keep as to drop.
Sutherland–Hodgman against the perpendicular bisector of the two sites. Clipping a CONCAVE ring this way yields coincident zero-width edges rather than separate pieces, but their contribution to the shoelace sum is exactly zero — so the AREA of the result is exact even though the ring itself may be degenerate. Only ever consume the area of the output, never its outline.
| QVector< double > GageAssignment::dequantizeWeights | ( | const ClusterKey & | key, |
| double | tol, | ||
| int | nGages | ||
| ) |
Dense weights implied by a key — the blend actually synthesised.
Recovering the weights from the key rather than from any one member's floats is what makes a cluster's generated series a pure function of its key, and therefore reproducible.
| key | As returned by quantizeWeights(). |
| tol | The same tolerance passed to quantizeWeights(). |
| nGages | Length of the returned vector. |
| QVector< QPair< int, double > > GageAssignment::idwWeights | ( | const QPointF & | p, |
| const QVector< QPointF > & | sites | ||
| ) |
Inverse-distance weights (power 2), normalised to sum 1.
The fallback for query points outside the natural-neighbour hull. Matches the engine's own convention in RainfallInterpolator so the GUI and the 2D solver agree. A query coincident with a site returns weight 1 on that site alone.
sites is empty. | ClusterKey GageAssignment::quantizeWeights | ( | const QVector< double > & | w, |
| double | tol = kDefaultClusterTol, |
||
| double | wEps = kWeightEpsilon |
||
| ) |
Quantise a dense weight vector into a canonical cluster key.
Clamps sub-wEps entries to zero, renormalises, rounds each weight to a multiple of tol, then pushes the rounding residual onto the largest term (ties toward the lowest index) so every key sums to the same constant. The result depends only on the weights, never on iteration order.
| w | Dense weights indexed by gage. Need not sum to 1. |
| tol | Agreement tolerance; must be > 0. |
| wEps | Zero-clamp threshold. |
w has no positive entry. | QVector< QPointF > GageAssignment::samplePolygon | ( | const QVector< QPointF > & | ring, |
| int | target = kDefaultSampleTarget |
||
| ) |
Interior sample points for area-averaging a field over a ring.
Lays a square lattice of pitch sqrt(area / target) offset by half a pitch and keeps the points that pass an even-odd interior test. The lattice is coarsened when a thin sliver would otherwise generate an unbounded candidate count. Falls back to EditGeometry::interiorPoint when the lattice catches nothing, so the result is never empty for a ring of three or more vertices.
| ring | Open ring. |
| target | Desired sample count, clamped to [50, 2000]. |
ring has < 3 vertices. | QVector< double > GageAssignment::thiessenAreaShares | ( | const QVector< QPointF > & | ring, |
| const QVector< QPointF > & | gages | ||
| ) |
Area of ring intersected with each gage's Voronoi cell.
| ring | Open subcatchment ring. |
| gages | Gage positions, in the same CRS as ring. Index-aligned with the returned vector. |
gages is empty. The sum equals the ring area (up to rounding) because Voronoi cells tile the plane.
|
constexpr |
Default weight-agreement tolerance for clustering (1%).
|
constexpr |
Default number of interior samples requested per ring.
Weights below this magnitude are clamped to zero before clustering.
Natural-neighbour and inverse-distance weighting both produce long microscopic tails. Left in place they fragment clusters without moving blended depth measurably — 1e-4 shifts it by under 0.01%.