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

Namespaces

namespace  mesh
 

Functions

QString mesh::validate (const StructuredPatch &p)
 Input checks. Empty string = valid.
 
QString mesh::validate (const SweptPatch &p)
 
QString mesh::validate (const PatchMesh &pm)
 Rejects a patch with a folded / concave / degenerate quad (mesh::cellIsConvex). Empty string = valid.
 
PatchMesh mesh::makeTransfinitePatch (const StructuredPatch &p, QString *err=nullptr)
 Transfinite interpolation on the four straight sides. The result has (n+1)×(m+1) vertices and n×m quads. On invalid input returns an empty PatchMesh and sets *err.
 
PatchMesh mesh::makeTransfinitePatch (const QVector< QVector< QPointF > > &sides, int n, int m, const QString &tag, QString *err=nullptr)
 Transfinite (Coons) interpolation on four POLYLINE sides forming a loop: sides[0] runs c0→c1, sides[1] c1→c2, sides[2] c2→c3, sides[3] c3→c0 (each side's last point equals the next side's first). Sides are arc-length parametrised; n subdivisions along sides 0/2, m along 1/3. Boundary vertices are placed ON the polylines (so the ring the caller emits as PSLG segments is exactly this patch's boundary loop). Returns an empty PatchMesh + *err on invalid input (side with < 2 points, endpoints not matching, n or m < 1, folded quad).
 
PatchMesh mesh::makeMappedPatch (const QPolygonF &ring, const QVector< int > &corners, double h, const QString &tag, QString *err=nullptr)
 Split a CCW ring at the four corners (ring vertex indices, ring order) into polyline sides, choose n = max(1, round(mean(len0, len2)/h)), m likewise from sides 1/3, and call the polyline overload.
 
PatchMesh mesh::makeSweptPatch (const SweptPatch &p, QString *err=nullptr)
 Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads. On invalid input (or a folded offset) returns an empty PatchMesh and sets *err.
 

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

Structured quad patches (TRI_QUAD_MESHING_PLAN §3.2, phase G3): transfinite four-sided patches and swept channel patches, in local indices. The polyline-side transfinite overload and makeMappedPatch serve the quad-region redesign (QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §4.2).

Variable Documentation

◆ cum

QVector<double> cum

cum[i] = arc length from pts[0] to pts[i].

◆ length

double length = 0.0

◆ pts

QVector<QPointF> pts