Loading...
Searching...
No Matches
meshquadmatch.h 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/meshquadquality.h"
#include "mesh/meshresult.h"
#include <QPair>
#include <QSet>
#include <QVector>
Include dependency graph for meshquadmatch.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mesh::QuadTemplate
 Four vertex ids in cyclic (CCW) order, indexed into the generated mesh passed to pairTrianglesIntoQuads(). More...
 
struct  mesh::QuadPairingOptions
 Policy for pairTrianglesIntoQuads(). More...
 
struct  mesh::QuadPairingStats
 Counts reported by pairTrianglesIntoQuads(). More...
 

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

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.
 
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.
 

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 triangles into quads inside a quad region (workplans/QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §4.4f) — no external library:

  1. TEMPLATE PAIRING. The caller supplies four vertex ids for each lattice square (a QuadTemplate). After triangulation, the two triangles whose vertex sets lie inside a template's four vertices (either diagonal) are looked up by sorted vertex triple and merged. Templates are visited best-score first; one whose triangles are already used, split (a vertex was inserted on its edge) or whose quad fails the bounds is skipped.
  2. GAP PAIRING. The residual region triangles form a dual graph (vertices = triangles, edges = shared unlocked edges whose union is an acceptable quad). Edmonds' blossom algorithm (maximum-cardinality matching) pairs as many as possible; an alternating-4-cycle polish then swaps pairs when Σ score increases. Unmatched triangles stay triangles.

Output honours the engine cell order (triangles first, then quads; existing quads keep their relative order after the new ones are appended behind them — see meshquadmerge.cpp for the same rebuild) and emits every quad CCW. Callers pass all cells of the mesh; only cellIds are touched.