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.h File Reference
#include <QPointF>
#include <QPolygonF>
#include <QString>
#include <QVector>
Include dependency graph for meshquadregion.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mesh::QuadRegion
 

Namespaces

namespace  mesh
 

Enumerations

enum class  mesh::QuadRegionMode {
  mesh::Auto ,
  mesh::Mapped ,
  mesh::Submapped ,
  mesh::Free ,
  mesh::TrianglesOnly
}
 

Functions

QPolygonF mesh::normalizeRingCCW (const QPolygonF &ring)
 Drop a closing duplicate, drop consecutive duplicates, make CCW.
 
double mesh::ringSignedArea (const QPolygonF &ring)
 Signed shoelace area (CCW positive).
 
bool mesh::pointInRing (const QPolygonF &ring, const QPointF &p)
 Odd-even point-in-polygon (closed ring, last == first optional).
 
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::ringIsSimple (const QPolygonF &ring)
 True when ring is simple (no proper self-intersection). O(n²).
 
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).
 
double mesh::ringTurnDeg (const QPolygonF &ring, int i)
 Exterior turning angle (degrees, CCW positive) at ring vertex i.
 

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 (workplans/QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §3, §4.1): closed polygons inside the meshing domain where quadrilateral cells are prioritised. Everything outside a region stays Triangle's triangles; the interface conforms because the region ring is a constraint loop in the same CDT.

This header holds the data model plus the pure-geometry helpers (validation, auto-classification, ring resampling). How a region is turned into cells lives in MeshGenerator::generate() (Free regions: meshcrossfield → meshquadpoints → Triangle → meshquadmatch → meshquadcleanup; Mapped / Submapped regions: meshpatch::makeMappedPatch / meshsubmap).