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
meshquadregion.cpp File Reference
#include "mesh/meshquadregion.h"
#include <algorithm>
#include <cmath>
#include <limits>
Include dependency graph for meshquadregion.cpp:

Namespaces

namespace  mesh
 

Functions

double mesh::ringSignedArea (const QPolygonF &ring)
 Signed shoelace area (CCW positive).
 
QPolygonF mesh::normalizeRingCCW (const QPolygonF &ring)
 Drop a closing duplicate, drop consecutive duplicates, make CCW.
 
bool mesh::pointInRegion (const QPolygonF &ring, const QVector< QPolygonF > &holes, const QPointF &p)
 Inside ring and outside every ring of holes — the region's meshable interior. With no holes this is exactly pointInRing().
 
bool mesh::pointInRing (const QPolygonF &ring, const QPointF &p)
 Odd-even point-in-polygon (closed ring, last == first optional).
 
bool mesh::ringIsSimple (const QPolygonF &ring)
 True when ring is simple (no proper self-intersection). O(n²).
 
double mesh::ringTurnDeg (const QPolygonF &ring, int i)
 Exterior turning angle (degrees, CCW positive) at ring vertex i.
 
QString mesh::validateQuadRegion (const QuadRegion &r, const QVector< QPolygonF > &domains, const QVector< QPolygonF > &holes)
 Validate one region: >= 3 distinct vertices, simple, area >= 4·h² (h = spacing when > 0, else skipped), every vertex inside exactly one of domains and outside every holes ring. Empty string = valid.
 
QString mesh::validateQuadRegionsDisjoint (const QVector< QuadRegion > &regions)
 Pairwise check: rings may share edges/vertices but no ring vertex of one may lie strictly inside another and edges may not properly cross. Returns the first offending pair as "region i overlaps region j", or "".
 
QuadRegionMode mesh::classifyQuadRegion (const QPolygonF &ring, QVector< int > *corners, double cornerTolDeg=25.0, double rectilinearTolDeg=2.0)
 Auto-classification (plan §4.1) on the normalised ring.
 
QPolygonF mesh::resampleRing (const QPolygonF &ring, double h, double keepTurnDeg=0.0)
 Resample a closed ring at spacing h: every edge is split into max(1, round(len/h)) equal parts; ring vertices whose |turn| >= keepTurnDeg are always kept, others are kept too (geometry is never simplified here — run pslg::simplifyPolyline first). Output is CCW, open (no closing duplicate).
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

PSLG quad regions (QUAD_MESHING_REDESIGN_PLAN §3, §4.1): ring normalisation, point-in-ring, simplicity, validation against the domain / hole rings, pairwise overlap test, auto-classification by turning angles and ring resampling at the lattice spacing.