Planning algorithms on standard containers: quad patch planning and placement, size fields, source-geometry simplification and the independent constraint and sizing audits. More...
Namespaces | |
| namespace | detail |
| Internal helpers of meshkit::plan; not part of the supported API. | |
| namespace | quadquality_detail |
| Internal checks behind the quadrilateral quality metrics; not part of the supported API. | |
Classes | |
| struct | BankPairPatch |
| Two open bank polylines with independently supplied directions. More... | |
| struct | ConstraintAuditExample |
| One recorded audit violation. More... | |
| struct | ConstraintAuditOptions |
| Pins, cancellation and resource limits for the constraint audits. More... | |
| struct | ConstraintAuditReport |
| Result of auditConstraintSimplification() or auditMeshConstraints(). More... | |
| struct | ConstraintPolicyOverride |
| Optional per-source changes to a parent ConstraintSimplificationPolicy, applied by resolve(). More... | |
| struct | ConstraintSegment |
| Constraint polyline with marker, tag and optional strip width. More... | |
| struct | ConstraintSimplificationOptions |
| Pins, cancellation and resource limits for simplifyConstraints(). More... | |
| struct | ConstraintSimplificationPolicy |
| Per-feature limits for constraint simplification. More... | |
| struct | ConstraintSimplificationResult |
| Output of simplifyConstraints(). More... | |
| struct | Line2 |
| Straight segment between two XY points. More... | |
| class | Map |
Hash map with the QHash-style API the CDT kernel uses, over std::unordered_map<K, V, Hash<K>>. More... | |
| struct | MeshEdge |
| Mesh edge between two vertex indices, carrying a source marker. More... | |
| struct | MeshResult |
| Mesh as read by the native audits: vertices, cells, marked edges and a status. More... | |
| struct | MeshTriangle |
| Mesh cell: a triangle, or a quadrilateral when v3 is nonnegative. More... | |
| struct | MeshVertex |
| Mesh vertex: planar position plus elevation. More... | |
| struct | PatchAssessment |
| Result of assessPlannedPatch(). More... | |
| struct | PatchDecision |
| Per-region record of what was decided about a mapped patch and why. More... | |
| struct | PatchInterfaceConflict |
| One patch interface edge whose two cells differ in size by more than allowed. More... | |
| struct | PatchInterfaceReport |
| Result of auditPatchInterfaces(). More... | |
| struct | PatchLimits |
| Acceptance limits and callbacks for one mapped patch; see assessPlannedPatch(). More... | |
| struct | PatchLine |
| A polyline through a patch's vertices that must be reported as mesh edges with a marker — a conduit running along a strip's middle row. More... | |
| struct | PatchMesh |
| A generated patch in local indices. More... | |
| class | Polygon |
| Point sequence in XY units used for polygon rings and polylines. More... | |
| struct | QuadBlockGrid |
| Local cell size on a regular grid; NaN marks unusable cells. More... | |
| struct | QuadBlockOptions |
| Policy for placeQuadBlocks(). More... | |
| struct | QuadPlan |
| Result of planQuadRegions(); patches are delivered only when ok is true. More... | |
| struct | QuadPlanningGeometry |
| Source geometry that protects areas from mapped patches; XY units, finite coordinates. More... | |
| struct | QuadPlanningOptions |
| Settings, budgets and patch limits for planQuadRegions(). More... | |
| struct | QuadQuality |
| Metrics of one quadrilateral, as computed by quadQuality(). More... | |
| struct | QuadQualityBounds |
| Acceptance bounds shared by pairing, cleanup, smoothing and the legacy tri-pair merge. More... | |
| struct | QuadRegion |
| A closed polygon whose interior should be meshed with quadrilaterals, with its holes, scheme, spacing and tagging policy. More... | |
| class | ReadArray |
| Read-only array that either owns its elements or reads them from borrowed storage. More... | |
| class | Set |
std::unordered_set<K, Hash<K>> with the QSet-style names the CDT kernel uses. More... | |
| struct | SimplificationChange |
| Per-feature outcome of simplifyConstraints(); changes are in input order. More... | |
| struct | SimplificationFeature |
| One constraint polyline or ring for simplification and the constraint audits. More... | |
| class | SizeField |
| Distance-to-feature field sampled as a max-area function. More... | |
| struct | SizeFieldOptions |
| Inputs to SizeField::build(): feature grading, caps, floor, terrain term and polygon overrides. More... | |
| struct | SteinerPoint |
| Mandatory mesh point with marker, tag and optional pre-sampled elevation. More... | |
| struct | StructuredPatch |
| Four-sided patch: corners in cyclic order (either orientation); n subdivisions along corner0→corner1 (and corner3→corner2), m along corner0→corner3 (and corner1→corner2). More... | |
| struct | SweptPatch |
Swept patch: the centreline is offset ±width/2 (mitred at interior vertices) and cut into across quads per station. More... | |
| class | Text |
| Owned byte string with the QString-style helpers used for tags and diagnostics. More... | |
| class | Vector |
std::vector<T> with the QVector-style member names the CDT kernel and plan model use. More... | |
Typedefs | |
| using | Bytes = std::string |
| Raw byte buffer held in a std::string; the planner uses it for exact binary keys. | |
Enumerations | |
| enum class | PatchDisposition { Triangles , Accepted , Repaired , RequiredFailure } |
| Outcome recorded for one quad region in a PatchDecision. More... | |
| enum class | QuadRegionMode { Auto , Mapped , Submapped , Free , TrianglesOnly } |
| Requested meshing scheme for a QuadRegion's interior. More... | |
Functions | |
| QuadBlockGrid | quadBlockGridFromMesh (const MeshResult &mesh, double pitch, const Vector< Vector< Point2 > > &blockers) |
| Estimate local equilateral side lengths from triangles and mask existing quads/features. | |
| QuadBlockGrid | quadBlockGridFromField (const Box2 &, double pitch, const std::function< double(const Box2 &)> &maximumSize, const Vector< Vector< Point2 > > &blockers, const std::function< bool()> &cancelled={}, std::int64_t maximumCells=1000000) |
| Sample a footprint size callback onto a candidate block grid and mask blockers. | |
| Vector< QuadRegion > | placeQuadBlocks (const QuadBlockGrid &grid, const QuadBlockOptions &options) |
| Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands. | |
| ConstraintAuditReport | auditConstraintSimplification (const Vector< SimplificationFeature > &original, const ConstraintSimplificationResult &candidate, const ConstraintAuditOptions &options={}) |
| Independently check a simplification candidate against its original features. | |
| ConstraintAuditReport | auditMeshConstraints (const Vector< SimplificationFeature > &constraints, const MeshResult &mesh, const ConstraintAuditOptions &options={}) |
| Check that a delivered mesh still carries every required source constraint. | |
| ConstraintSimplificationResult | simplifyConstraints (const Vector< SimplificationFeature > &features, const ConstraintSimplificationOptions &options={}) |
| Remove redundant constraint vertices within each feature's policy without moving any coordinate. | |
| bool | cellIsConvex (const Vector< MeshVertex > &v, const MeshTriangle &c) |
| Test whether a cell is a strictly convex quadrilateral; triangles always pass. | |
| Text | validate (const StructuredPatch &p) |
| Input checks. | |
| Text | validate (const SweptPatch &p) |
| Input checks for a swept patch: >= 2 finite centreline points with no repeated consecutive vertex, finite width > 0, across >= 1, finite along >= 0, and station, cell and boundary counts that fit in int. | |
| Text | validate (const PatchMesh &pm) |
| Requires finite convex CCW quads, consistently shared cell edges, and one simple boundary matching exactly the outer cell edges. | |
| Polygon | orderedPatchBoundary (const PatchMesh &pm, Text *err=nullptr) |
| Validate the complete patch and return its CCW boundary, without a repeated closing vertex. | |
| PatchMesh | makeTransfinitePatch (const StructuredPatch &p, Text *err=nullptr) |
| Transfinite interpolation on the four straight sides. | |
| PatchMesh | makeSweptPatch (const SweptPatch &p, Text *err=nullptr) |
| Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads. | |
| PatchMesh | makeBankPairPatch (const BankPairPatch &p, Text *err=nullptr) |
| Build a conforming strip between two simple, disjoint banks. | |
| PatchMesh | makeTransfinitePatch (const Vector< Vector< Point2 > > &sides, int n, int m, const Text &tag, Text *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). | |
| PatchMesh | makeTransfinitePatchAtStations (const Vector< Vector< Point2 > > &sides, const Text &tag, Text *err=nullptr) |
| Coons patch on four already-stationed sides that keeps every station exactly. | |
| PatchMesh | makeMappedPatch (const Polygon &ring, const Vector< int > &corners, double h, const Text &tag, Text *err=nullptr) |
Split a ring (either winding) 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 | makeMappedPatch (const Polygon &ring, const Vector< int > &corners, double hAlong, double hAcross, double alongAngleDeg, const Text &tag, Text *err=nullptr) |
| Mapped patch with independent physical-axis spacing. | |
| PatchAssessment | assessPlannedPatch (const PatchMesh &, const PatchLimits &) |
| Check a mapped patch cell by cell against shape, size and terrain limits. | |
| QuadPlan | planQuadRegions (const Vector< QuadRegion > &, const QuadPlanningGeometry &, const QuadPlanningOptions &={}) |
| Plan mapped quad patches for all regions jointly, before CDT construction. | |
| PatchInterfaceReport | auditPatchInterfaces (const MeshResult &, const Vector< MeshEdge > &, double maximumRatio, const std::function< bool()> &cancelled={}, int maximumExamples=64) |
| Check the size transition across delivered patch interface edges. | |
| QuadQuality | quadQuality (const Point2 &a, const Point2 &b, const Point2 &c, const Point2 &d) |
| Measure one quadrilateral using cyclic corners and translation/scale-resistant planar arithmetic. | |
| QuadQuality | quadQuality (const Vector< MeshVertex > &vertices, const MeshTriangle &t) |
| Measure a quad cell through its borrowed vertex records. | |
| bool | quadAcceptable (const QuadQuality &q, const QuadQualityBounds &b) |
| Apply inclusive hard angle/Jacobian/aspect limits to a valid convex metric record. | |
| double | quadScore (const QuadQuality &q, const QuadQualityBounds &b) |
| Rank valid convex quads by Jacobian, rectangularity and a soft aspect penalty. | |
| double | triangleScaledJacobian (const Point2 &a, const Point2 &b, const Point2 &c) |
| Compute the minimum orientation-normalized corner sine of a triangle. | |
| double | cellCornerAngleDeg (const Vector< MeshVertex > &v, const MeshTriangle &t, int i) |
| Compute the unsigned corner angle of a triangle or quad. | |
| QuadQualityBounds | quadRegionQualityBounds (const QuadRegion ®ion, QuadQualityBounds global) |
| Copy global quality bounds and apply an explicitly nonnegative region aspect override. | |
| Polygon | normalizeRingCCW (const Polygon &ring) |
| Copy a ring while dropping scale-fuzzy consecutive/closing duplicates and reversing negative area. | |
| bool | polylineIntersectsRect (const Vector< Point2 > &path, const Box2 &rect) |
| Test whether any consecutive path segment meets a normalized closed rectangle. | |
| double | ringSignedArea (const Polygon &ring) |
| Compute oriented shoelace area after translating corners to the first vertex. | |
| bool | pointInRing (const Polygon &ring, const Point2 &p) |
| Test a point using a strict horizontal-ray odd-even crossing rule. | |
| bool | pointInRegion (const Polygon &ring, const Vector< Polygon > &holes, const Point2 &p) |
| Combine outer-ring parity with exclusion by every supplied hole-ring parity. | |
| bool | ringIsSimple (const Polygon &ring) |
| Reject proper nonadjacent edge crossings using plain double orientation signs. | |
| Text | validateQuadRegion (const QuadRegion &r, const Vector< Polygon > &domains, const Vector< Polygon > &holes) |
| Check region authoring policy, normalized ring and sampled domain/hole containment. | |
| Text | validateQuadRegionsDisjoint (const Vector< QuadRegion > ®ions) |
| Check explicit region pairs for proper crossings or strictly interior sampled vertices. | |
| QuadRegionMode | classifyQuadRegion (const Polygon &ring, Vector< int > *corners, double cornerTolDeg=25.0, double rectilinearTolDeg=2.0) |
| Heuristically classify normalized ring turns as Mapped, Submapped or Free. | |
| Polygon | resampleRing (const Polygon &ring, double h, double keepTurnDeg=0.0) |
| Normalize a ring and insert equal-part subdivisions along all implicit closing edges. | |
| double | ringTurnDeg (const Polygon &ring, int i) |
| Compute a signed exterior turn at one ring corner using adjacent edge cross/dot products. | |
Variables | |
| constexpr double | pi = 3.141592653589793238462643383279502884 |
| The constant pi as a double. | |
Planning algorithms on standard containers: quad patch planning and placement, size fields, source-geometry simplification and the independent constraint and sizing audits.
The Qt facades in namespace mesh delegate to these implementations.
| using meshkit::plan::Bytes = std::string |
Raw byte buffer held in a std::string; the planner uses it for exact binary keys.
|
strong |
Outcome recorded for one quad region in a PatchDecision.
| Enumerator | |
|---|---|
| Triangles | No mapped patch is delivered and the region is left to triangles (the default). |
| Accepted | Mapped patch accepted without any repair round. |
| Repaired | Mapped patch obtained after refinement: in a QuadPlan, accepted after at least one station-doubling repair round; the native job also records it for a required region whose spacing it halves before retrying. |
| RequiredFailure | A required region could not be planned, so the whole plan was refused. |
|
strong |
Requested meshing scheme for a QuadRegion's interior.
| Enumerator | |
|---|---|
| Auto | classifyQuadRegion() decides: Mapped → Submapped → Free. |
| Mapped | Four logical sides (polylines) → transfinite quads. Needs 4 corners. |
| Submapped | Exactly rectilinear ring → grid-based structured quads. |
| Free | Cross-field aligned lattice + template pairing (quad-dominant). |
| TrianglesOnly | Region ring is still a constraint loop, interior stays triangles. |
| PatchAssessment meshkit::plan::assessPlannedPatch | ( | const PatchMesh & | patch, |
| const PatchLimits & | limits ) |
Check a mapped patch cell by cell against shape, size and terrain limits.
The first argument is the patch, of which only PatchMesh::xy and PatchMesh::quads are read (boundary and topology are not validated; see validate(const PatchMesh &)). The second holds the limits and callbacks. Checking stops at the first failing cell. Each cell must be a quadrilateral with in-range, finite vertices that is convex with positive area in either winding; then, where enabled, the minimum edge, minimum angle, maximum aspect, directional spacing, footprint size and terrain error limits are tested with a small relative tolerance (about 1e-9). Callbacks run synchronously on the calling thread.
| ConstraintAuditReport meshkit::plan::auditConstraintSimplification | ( | const Vector< SimplificationFeature > & | original, |
| const ConstraintSimplificationResult & | candidate, | ||
| const ConstraintAuditOptions & | options = {} ) |
Independently check a simplification candidate against its original features.
Per feature: valid policy; unchanged id, closed, role, marker, requiredInMesh and elevation presence; a strictly increasing source mapping; retained vertices and heights exactly equal to their sources; endpoints and ring closure kept; no Preserve-mode, fixed or above-maxTurnDegrees vertex removed; consistent removed count; ring orientation and area limits; XY/Z deviation and monotone projection of each removed vertex. Then source rings must not touch themselves and, when anything was removed, each new shortcut is checked against other output edges, pins and the original graph for crossings, collapsed distinct paths, lost junctions, swept pockets and minimumClearance.
| [in] | original | Features given to simplifyConstraints(); read only, not retained. |
| [in] | candidate | Its result; must be ok with one feature and change per original. |
| [in] | options | Pins, cancellation and limits; the callback runs synchronously. |
| ConstraintAuditReport meshkit::plan::auditMeshConstraints | ( | const Vector< SimplificationFeature > & | constraints, |
| const MeshResult & | mesh, | ||
| const ConstraintAuditOptions & | options = {} ) |
Check that a delivered mesh still carries every required source constraint.
Each non-degenerate segment of a feature with requiredInMesh must be covered end to end, from its first to its last vertex, by a chain of delivered edges (mesh.boundaryEdges) lying on it within coordinateRoundoff, each with one or two incident cells and, for a nonzero feature marker, the same marker. Domain and Hole edges need their cells on the correct side (see SimplificationFeature::Role); delivered endpoint z must match authored z to roundoff. Not a general cell-overlap proof.
| [in] | constraints | Source features; Domain/Hole rings also define the inside used for side checks. Read only, not retained. |
| [in] | mesh | Delivered mesh; must have ok set. Read only, not retained. |
| [in] | options | Cancellation and limits; protectedPoints is not used. |
| PatchInterfaceReport meshkit::plan::auditPatchInterfaces | ( | const MeshResult & | mesh, |
| const Vector< MeshEdge > & | boundaries, | ||
| double | maximumRatio, | ||
| const std::function< bool()> & | cancelled = {}, | ||
| int | maximumExamples = 64 ) |
Check the size transition across delivered patch interface edges.
Every cell is scanned once and must have positive (CCW) area, not only the cells on listed edges; the nominal sizes of the two cells on each listed edge are compared. Storage grows with the number of listed edges. The first two parameters are unnamed in this declaration; the names below are the definition's.
| [in] | mesh | The delivered mesh (MeshResult::ok is not read). |
| [in] | boundaries | Patch boundary edges as vertex index pairs into the mesh's vertices; orientation does not matter and MeshEdge::marker and tag are ignored. |
| [in] | maximumRatio | Largest allowed ratio between the two nominal sizes; must be finite and >= 1. |
| [in] | cancelled | Optional callback polled before the first cell and every 4096 cells; returning true stops the audit with PatchInterfaceReport::cancelled. |
| [in] | maximumExamples | Number of violation examples to keep, clamped to [0, 1000]. |
|
inline |
Compute the unsigned corner angle of a triangle or quad.
| [in] | v | Stable vertex storage containing every referenced cell index in range. |
| [in] | t | Valid cyclic cell, preserved. |
| [in] | i | Local corner in[0,t.vertexCount()), unchecked. |
Interior angle at corner i of a cell (degrees), triangles and quads.
|
inline |
Test whether a cell is a strictly convex quadrilateral; triangles always pass.
| [in] | v | Vertex array that c indexes; indices are not range-checked. |
| [in] | c | Cell to test. |
| QuadRegionMode meshkit::plan::classifyQuadRegion | ( | const Polygon & | ring, |
| Vector< int > * | corners, | ||
| double | cornerTolDeg = 25.0, | ||
| double | rectilinearTolDeg = 2.0 ) |
Heuristically classify normalized ring turns as Mapped, Submapped or Free.
| [in] | ring | Borrowed finite valid planar ring, unchanged; normalized CCW/open before evaluating turns. |
| [out] | corners | Optional borrowed vector, cleared first; Mapped success fills four indices into the normalized ring, not necessarily original input positions. Other modes leave it empty. |
| [in] | cornerTolDeg | Finite nonnegative degree tolerance, default 25. Mapped needs exactly four turns within inclusive 90+/-tolerance and all other absolute turns strictly below tolerance. |
| [in] | rectilinearTolDeg | Finite nonnegative degree tolerance, default 2. Submapped accepts every absolute turn close to 90 or close to zero (straight-through vertices are allowed). |
Auto-classification (plan §4.1) on the normalised ring.
Turning angle at each vertex (exterior angle, CCW positive): - exactly four vertices with turn in [90 − cornerTolDeg, 90 + cornerTolDeg] and every other |turn| < cornerTolDeg → Mapped (corners = those four, in ring order); - every turn within rectilinearTolDeg of ±90° or zero → Submapped; - otherwise Free. corners receives the Mapped corners when non-null (cleared otherwise).
| PatchMesh meshkit::plan::makeBankPairPatch | ( | const BankPairPatch & | p, |
| Text * | err = nullptr ) |
Build a conforming strip between two simple, disjoint banks.
Build a conforming strip between two finite simple disjoint open banks.
Rejects ambiguous endpoint pairing, touching/crossing banks, folded cells, unrepresentable station geometry and unsafe subdivision counts.
| [in] | p | Borrowed bank arrays/across/along/tag, unchanged. across>=1, finite nonnegative along; each bank >=2 finite nonduplicate consecutive points and not explicitly closed. Common XY units. |
| [out] | err | Optional borrowed diagnostic, set on failure, not retained; success clearing is stated below. |
| PatchMesh meshkit::plan::makeMappedPatch | ( | const Polygon & | ring, |
| const Vector< int > & | corners, | ||
| double | h, | ||
| const Text & | tag, | ||
| Text * | err ) |
Split a ring (either winding) 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.
Choose isotropic subdivision counts from opposite-side arc lengths and build a Coons patch.
| [in] | ring | Borrowed finite ring in either winding, unchanged; exact repeated closing point allowed. |
| [in] | corners | Borrowed four strictly increasing indices in original open-ring order, unchanged. |
| [in] | h | Positive finite target spacing in ring XY units; opposite mean lengths round to nearest positive integer count, so h is a target rather than strict maximum gap. |
| [in] | tag | Borrowed copied patch/cell tag, unchanged. |
| [out] | err | Optional borrowed diagnostic, set on failure, not retained; success clearing is stated below. |
| PatchMesh meshkit::plan::makeMappedPatch | ( | const Polygon & | ring, |
| const Vector< int > & | corners, | ||
| double | hAlong, | ||
| double | hAcross, | ||
| double | alongAngleDeg, | ||
| const Text & | tag, | ||
| Text * | err = nullptr ) |
Mapped patch with independent physical-axis spacing.
Associate physical directional spacings with opposite logical side pairs before Coons generation.
The axis is undirected, measured counterclockwise from +x in degrees. The opposite logical side pair most aligned with it receives hAlong; the other receives hAcross. Equal association scores are rejected. Ring rotation/reversal must not exchange the physical spacings. Widths use the ring's coordinate units.
| [in] | ring | Borrowed finite cyclic ring, either winding, unchanged; exact closing duplicate allowed. |
| [in] | corners | Borrowed four strictly increasing open-ring indices, unchanged. |
| [in] | hAlong | Positive finite target spacing along the selected physical axis, ring horizontal units. |
| [in] | hAcross | Positive finite orthogonal target spacing in same units. |
| [in] | alongAngleDeg | Finite undirected axis counterclockwise from +x, degrees modulo 180. |
| [in] | tag | Borrowed copied tag, unchanged. |
| [out] | err | Optional borrowed diagnostic, set on failure, not retained; success clearing is stated below. |
| PatchMesh meshkit::plan::makeSweptPatch | ( | const SweptPatch & | p, |
| Text * | err = nullptr ) |
Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads.
Sweep a finite centerline with mitred offsets into a globally validated quad strip.
Station and index counts are checked before allocation. Invalid or globally overlapping/touching offsets return an empty PatchMesh and a diagnostic identifying the affected stations.
| [in] | p | Borrowed centerline/positive width/across/along spacing/tag, unchanged, common XY units. Original vertices retained and each segment subdivided to target along spacing when positive. |
| [out] | err | Optional borrowed diagnostic, set on failure, not retained; success clearing is stated below. |
| PatchMesh meshkit::plan::makeTransfinitePatch | ( | const StructuredPatch & | p, |
| Text * | err = nullptr ) |
Transfinite interpolation on the four straight sides.
Generate a bilinear grid between four straight convex sides.
The result has (n+1)×(m+1) vertices and n×m quads. On invalid input returns an empty PatchMesh and sets *err.
| [in] | p | Borrowed cyclic four-corner patch, unchanged, common finite XY frame; n,m>=1 checked. |
| [out] | err | Optional borrowed diagnostic, set on failure, not retained; success clearing is stated below. |
| PatchMesh meshkit::plan::makeTransfinitePatch | ( | const Vector< Vector< Point2 > > & | sides, |
| int | n, | ||
| int | m, | ||
| const Text & | tag, | ||
| Text * | 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 meshkit::plan::makeTransfinitePatchAtStations | ( | const Vector< Vector< Point2 > > & | sides, |
| const Text & | tag, | ||
| Text * | err = nullptr ) |
Coons patch on four already-stationed sides that keeps every station exactly.
| [in] | sides | Four cyclic sides, each with >= 2 finite points and nonzero length; sides[k] must end exactly where sides[(k+1)%4] starts. Sides 0 and 2 (and 1 and 3) need equal point counts: station i of side 0 faces station n-i of side 2, and station j of side 1 faces station m-j of side 3. |
| [in] | tag | Label copied to the patch and to every quad. |
| [out] | err | Optional; set on failure and left unchanged on success. |
Copy a ring while dropping scale-fuzzy consecutive/closing duplicates and reversing negative area.
| [in] | ring | Borrowed finite planar points, unchanged; fuzzy coordinate tolerance is 1e-9 times max(1,largest absolute original coordinate), separately on x/y, so it depends on projected origin. |
Drop a closing duplicate, drop consecutive duplicates, make CCW.
Validate the complete patch and return its CCW boundary, without a repeated closing vertex.
Validate a quad patch and extract its ordered open CCW perimeter.
Segment input orientation/order is immaterial. On failure returns an empty ring and sets err.
| [in] | pm | Borrowed patch, unchanged; full validatePatchMesh checks apply. |
| [out] | err | Optional borrowed diagnostic, set on failure, not retained; success clearing is stated below. |
| Vector< QuadRegion > meshkit::plan::placeQuadBlocks | ( | const QuadBlockGrid & | grid, |
| const QuadBlockOptions & | options ) |
Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands.
| [in] | grid | Borrowed stable grid with finite positive pitch/origin and valid storage extent, unchanged; nonfinite/nonpositive h entries are unusable. All logarithmic band indices, powers, spacing-to-cell ceil conversions and loop/product arithmetic must be representable. |
| [in] | options | Borrowed policy with finite bandRatio>1, feasible finite minSpacing and positive minQuadsPerSide recommended. maxBlocks<=0 produces no regions; nonpositive minimum spacing does not filter. |
Axis-aligned rectangles over nearly uniform usable cells, largest first, each at least minQuadsPerSide quads of its spacing per side, kept one spacing apart from each other. Each comes back as a Mapped QuadRegion whose spacing is its band's.
| QuadPlan meshkit::plan::planQuadRegions | ( | const Vector< QuadRegion > & | regions, |
| const QuadPlanningGeometry & | geometry, | ||
| const QuadPlanningOptions & | options = {} ) |
Plan mapped quad patches for all regions jointly, before CDT construction.
The first argument lists the regions. Every region whose mode is not TrianglesOnly is a four-sided mapped candidate, with corners from QuadRegion::corners or, when that is empty, the ring vertices that turn by more than 30 degrees; exactly four, in strictly increasing ring order, are required. Rings may wind either way and cells come out CCW. The second argument is the protecting source geometry and the third the settings (defaults when omitted). Spacing comes from QuadRegion::spacing or QuadPlanningOptions::defaultSize, or from hAlong/hAcross assigned to the side pairs by alignment with mappedAlongAngleDeg; PatchLimits::maximumSize can shrink it. Sides that coincide exactly share one station sequence and opposite sides share one count. A candidate that fails a repairable limit has its side counts doubled, for up to QuadPlanningOptions::maximumRepairRounds rounds. When two patches meet along partial sides with unmatched stations, the lower-priority one is refused instead of leaving a T-junction.
An optional region that cannot be planned keeps PatchDisposition::Triangles. A required region failure, cancellation, an exhausted budget, invalid settings or a non-finite source coordinate makes QuadPlan::ok false and returns no patches. Callbacks run synchronously on the calling thread; cancellation is polled at the start and every 4096 work units.
| bool meshkit::plan::pointInRegion | ( | const Polygon & | ring, |
| const Vector< Polygon > & | holes, | ||
| const Point2 & | p ) |
Combine outer-ring parity with exclusion by every supplied hole-ring parity.
| [in] | ring | Borrowed finite planar outer ring, unchanged. |
| [in] | holes | Borrowed finite hole rings in the same frame, unchanged; no containment/disjointness validation. |
| [in] | p | Borrowed finite point, unchanged. |
Inside ring and outside every ring of holes — the region's meshable interior. With no holes this is exactly pointInRing().
Test a point using a strict horizontal-ray odd-even crossing rule.
| [in] | ring | Borrowed finite planar ring, unchanged; scale-fuzzy closing duplicate ignored. |
| [in] | p | Borrowed finite query in the same planar units, unchanged. |
Odd-even point-in-polygon (closed ring, last == first optional).
Test whether any consecutive path segment meets a normalized closed rectangle.
| [in] | path | Borrowed finite planar coordinates, unchanged; at least two points required, zero-length segments still test as points. Parameter-interval arithmetic must remain representable. |
| [in] | rect | Borrowed finite rectangle in the same planar units, unchanged; normalized internally, zero-width/height normalized boxes return false. |
True when any segment of a finite-coordinate polyline intersects the closed rectangle, including boundary contact and axis-aligned paths. Fewer than two points or an empty rectangle returns false.
|
inline |
Apply inclusive hard angle/Jacobian/aspect limits to a valid convex metric record.
| [in] | q | Stable metrics with positive finite area and valid ranges, otherwise rejected. |
| [in] | b | Finite thresholds, angles degrees, minimum Jacobian and maximum aspect dimensionless; maxAspect<=0 disables aspect cap. Caller chooses meaningful angle/score limits; no automatic clamping. |
Hard acceptance test (finite valid geometry + convexity + unchanged angle bounds, SJ floor and aspect cap).
| QuadBlockGrid meshkit::plan::quadBlockGridFromField | ( | const Box2 & | bounds, |
| double | pitch, | ||
| const std::function< double(const Box2 &)> & | maximumSize, | ||
| const Vector< Vector< Point2 > > & | blockers, | ||
| const std::function< bool()> & | cancelled = {}, | ||
| std::int64_t | maximumCells = 1000000 ) |
Sample a footprint size callback onto a candidate block grid and mask blockers.
Arguments, in order:
pitch, the positive finite cell side in the same units;maximumSize, a required callback giving the conservative size bound over a cell's box; it is called once per cell, synchronously, and its exceptions propagate;blockers, borrowed paths whose consecutive segments are sampled at most half a pitch apart, marking each sample's cell and its eight neighbours unusable;cancelled, an optional poll checked every 4096 cells and blocker samples;maximumCells, the largest allowed cell count (>= 1).Each usable cell stores 0.9 times its size bound; a zero, negative, nonfinite or float-overflowing bound leaves the cell unusable (NaN).
| QuadBlockGrid meshkit::plan::quadBlockGridFromMesh | ( | const MeshResult & | mesh, |
| double | pitch, | ||
| const Vector< Vector< Point2 > > & | blockers ) |
Estimate local equilateral side lengths from triangles and mask existing quads/features.
| [in] | mesh | Borrowed stable finite valid triangle/quad geometry, unchanged. Every cell vertex ID must be in range; area/centroid/products and grid coordinate-to-int conversions must be representable. |
| [in] | pitch | Finite positive background cell side in planar mesh units, feasible integer dimensions; nonpositive/NaN or no vertices returns invalid grid, but infinite pitch is caller-invalid, not rejected. |
| [in] | blockers | Borrowed finite feature paths in the same CRS/units, unchanged. Only consecutive segments are sampled, so repeat first point to close rings. Sample-step counts must fit int. |
The local cell size of mesh on a grid of pitch, with every cell touched by blockers (domain and hole rings, constraint lines, break lines) or by an existing quad marked unusable.
|
inline |
Measure one quadrilateral using cyclic corners and translation/scale-resistant planar arithmetic.
| [in] | a | First finite planar corner, used as local origin; same coordinate units as other corners. |
| [in] | b | Second cyclic corner, preserved. |
| [in] | c | Third cyclic corner, preserved. |
| [in] | d | Fourth cyclic corner, preserved; winding may be clockwise or counterclockwise. |
Metrics for corners a,b,c,d in cyclic order. Coordinates and all metric values, including positive area, must remain representable. Invalid inputs return a non-convex result; CW and CCW valid quads share metrics.
|
inline |
Measure a quad cell through its borrowed vertex records.
| [in] | vertices | Stable storage containing every t index in range, planar coordinates in common units. |
| [in] | t | Quad with four valid indices and v3>=0; triangle or invalid index use is unchecked. |
Metrics for quad cell t of vertices (t.v3 >= 0 required).
|
inline |
Copy global quality bounds and apply an explicitly nonnegative region aspect override.
| [in] | region | Borrowed region policy, unchanged; aspectMax<0 inherits, zero disables aspect cap, positive values override. NaN compares false/inherits; infinity is copied and later finite checks reject it. |
| [in] | global | Bounds copied by value, only maxAspect can change. |
Resolve Free-region bounds. Only the aspect cap may override the global bounds; negative values inherit and zero explicitly disables it.
|
inline |
Rank valid convex quads by Jacobian, rectangularity and a soft aspect penalty.
| [in] | q | Stable metrics, invalid ranges/nonconvex/nonfinite geometry scores zero. |
| [in] | b | Finite bounds; only positive maxAspect affects score, other finite hard thresholds are not applied here. Nonpositive maxAspect disables penalty. |
Pairing / legacy tri-pair ranking in [0,1]: SJ · rectangularity · min(1, aspectMax/aspect). Perfect rectangles within the configured aspect cap tie squares; angle distortion penalizes rhombi and kites. Diagonal skew remains a diagnostic, not a ranking term. Invalid/non-convex quads score zero. Smoothing retains its separate SJ guard.
Normalize a ring and insert equal-part subdivisions along all implicit closing edges.
| [in] | ring | Borrowed finite planar ring, unchanged; fuzzy duplicates are removed and winding normalized. |
| [in] | h | Finite positive target spacing in planar units; nonpositive/NaN returns normalized ring. For active resampling every lround(edgeLength/h), int narrowing and output count must be representable. |
| [in] | keepTurnDeg | Retained compatibility parameter in degrees, currently ignored; every normalized original vertex survives regardless of turn. |
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).
| bool meshkit::plan::ringIsSimple | ( | const Polygon & | ring | ) |
Reject proper nonadjacent edge crossings using plain double orientation signs.
| [in] | ring | Borrowed finite planar sequence, unchanged; fuzzy closing duplicate ignored. |
True when ring is simple (no proper self-intersection). O(n²).
| double meshkit::plan::ringSignedArea | ( | const Polygon & | ring | ) |
Compute oriented shoelace area after translating corners to the first vertex.
| [in] | ring | Borrowed finite planar sequence, unchanged; closes implicitly, explicit duplicate allowed. |
Signed shoelace area (CCW positive).
| double meshkit::plan::ringTurnDeg | ( | const Polygon & | ring, |
| int | i ) |
Compute a signed exterior turn at one ring corner using adjacent edge cross/dot products.
| [in] | ring | Borrowed finite planar sequence, unchanged; fuzzy closing duplicate excluded. |
| [in] | i | Corner index, wrapped cyclically including negative values; modulo/addition must fit int. |
Exterior turning angle (degrees, CCW positive) at ring vertex i.
| ConstraintSimplificationResult meshkit::plan::simplifyConstraints | ( | const Vector< SimplificationFeature > & | features, |
| const ConstraintSimplificationOptions & | options = {} ) |
Remove redundant constraint vertices within each feature's policy without moving any coordinate.
Validates every policy, coordinate, elevation count and protected point first. Open-line endpoints, fixed vertices, corners above maxTurnDegrees, ring vertex 0 (plus two more when a ring would keep fewer than three) are always kept. A shortcut over a span must keep every removed vertex within maxDeviation/maxZDeviation with strictly increasing projection inside the shortcut, and must not cross, overlap, sweep over, lose a crossing with or (with minimumClearance) approach other original segments or protected points. A rejected span is split and retried. Rings failing the area limits, and features whose output shortcuts intersect, are restored.
| [in] | features | Input features in one planar frame; read only, not retained. |
| [in] | options | Pins, cancellation and limits; the callback runs synchronously. |
|
inline |
Compute the minimum orientation-normalized corner sine of a triangle.
| [in] | a | First planar vertex, finite coordinates and representable differences/products required. |
| [in] | b | Second vertex in same coordinate units. |
| [in] | c | Third vertex in same coordinate units, winding may be either direction. |
Minimum sine of a triangle's angles (1 is unattainable; equilateral = 0.866; right isosceles = 0.707). Used by the smoothing guard for the triangles that remain inside a quad region.
Requires finite convex CCW quads, consistently shared cell edges, and one simple boundary matching exactly the outer cell edges.
Validate complete convex CCW quad patch topology and one simple matching boundary.
Boundary crossings, remote touches, holes and disconnected pieces are rejected; an indexed boundary check avoids comparing every cell pair. Empty string = valid.
| [in] | pm | Borrowed local-index patch, unchanged; vertex/cell/boundary counts must fit int. |
| Text meshkit::plan::validate | ( | const StructuredPatch & | p | ) |
Input checks.
Check four finite convex cyclic corners and representable subdivision products.
Empty string = valid.
| [in] | p | Borrowed structured patch, unchanged; corners may use either winding, subdivisions >=1. |
| Text meshkit::plan::validate | ( | const SweptPatch & | p | ) |
Input checks for a swept patch: >= 2 finite centreline points with no repeated consecutive vertex, finite width > 0, across >= 1, finite along >= 0, and station, cell and boundary counts that fit in int.
Check swept input geometry and representable station/cell/boundary counts.
Folded or overlapping offsets are not detected here (makeSweptPatch() checks them). Empty string = valid, otherwise the first problem found; the parameter and return value are documented with the definition.
| [in] | p | Borrowed patch, unchanged; >=2 finite nonduplicate consecutive centerline vertices, positive finite width, across>=1 and finite nonnegative along spacing required, common XY units. |
| Text meshkit::plan::validateQuadRegion | ( | const QuadRegion & | r, |
| const Vector< Polygon > & | domains, | ||
| const Vector< Polygon > & | holes ) |
Check region authoring policy, normalized ring and sampled domain/hole containment.
| [in] | r | Borrowed region, unchanged. Finite aspect override must be negative/inherit, zero/unbounded or >=1. Directional spacing requires finite positive along/across lengths and finite angle, Auto/Mapped mode, no background flag or owned holes; isotropic spacing is used only when >0 without an explicit finite check. |
| [in] | domains | Borrowed finite planar domain rings, unchanged; empty skips domain tests, background regions also skip them. Every normalized vertex plus area centroid must lie in exactly one same domain, with scale-fuzzy boundary counting inside. |
| [in] | holes | Borrowed finite excluded rings in the same units, unchanged. A vertex/centroid strictly inside a hole rejects, fuzzy boundary contact is allowed. r.holes is not otherwise geometrically validated here. |
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.
| Text meshkit::plan::validateQuadRegionsDisjoint | ( | const Vector< QuadRegion > & | regions | ) |
Check explicit region pairs for proper crossings or strictly interior sampled vertices.
| [in] | regions | Borrowed finite region rings, unchanged; normalized to open CCW copies. Call individual validation separately; degenerate <3-corner rings are ignored by overlap testing. |
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 "".
|
inlineconstexpr |
The constant pi as a double.