Loading...
Searching...
No Matches
meshquadmatch.cpp File Reference

Pairing triangles into quads inside a quad region (workplans/QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §4.4f) — no external library. More...

#include "mesh/meshquadmatch.h"
#include "mesh/meshcellgeom.h"
#include "mesh/meshedgekey.h"
#include <QHash>
#include <algorithm>
#include <cmath>
Include dependency graph for meshquadmatch.cpp:

Namespaces

namespace  mesh
 The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and cell attributes, the mesh generator, quad regions, matching and cleanup, mesh statistics, and the INP and 2DM mesh codecs.
 

Functions

QVector< int > mesh::maximumMatching (int n, const QVector< QPair< int, int > > &edges)
 Compute an unweighted maximum-cardinality matching in an undirected general graph.
 
bool mesh::unionQuad (const QVector< MeshVertex > &vertices, const MeshTriangle &t1, const MeshTriangle &t2, MeshTriangle &quad)
 Form and convexity-check a CCW quadrilateral candidate from two triangle records.
 
QuadPairingStats mesh::pairTrianglesIntoQuads (MeshResult &mesh, const QVector< int > &cellIds, const QVector< QuadTemplate > &templates, const QSet< QPair< int, int > > &lockedEdges, const QuadPairingOptions &opts, QVector< int > *oldToNew)
 Pair selected valid triangle rows into acceptable CCW quads, then rebuild engine cell order.
 

Detailed Description

Pairing triangles into quads inside a quad region (workplans/QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §4.4f) — no external library.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License
Apache-2.0

Pairing region triangles into quads (QUAD_MESHING_REDESIGN_PLAN §4.4f): template lookup by sorted vertex triple (best score first), then an unweighted Edmonds blossom maximum-cardinality matching on the residual dual graph, then an alternating-4-cycle polish that swaps two adjacent pairs when the summed score increases. Cells are rebuilt triangles-first exactly like meshquadmerge.cpp.