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
meshkit::plan Namespace Reference

Namespaces

namespace  detail
 
namespace  quadquality_detail
 

Classes

struct  BankPairPatch
 Two open bank polylines with independently supplied directions. Endpoints are paired by minimum total connection length. Stations use the union of normalized arc-length vertices, retaining every bank bend exactly. Positive along subdivides that union to the target spacing; zero retains only the union. This is normalized arc correspondence, not surveyed stations. More...
 
struct  ConstraintAuditExample
 
struct  ConstraintAuditOptions
 
struct  ConstraintAuditReport
 
struct  ConstraintPolicyOverride
 
struct  ConstraintSegment
 
struct  ConstraintSimplificationOptions
 
struct  ConstraintSimplificationPolicy
 
struct  ConstraintSimplificationResult
 
struct  Line2
 
struct  MeshEdge
 
struct  MeshResult
 
struct  MeshTriangle
 
struct  MeshVertex
 
struct  PatchAssessment
 
struct  PatchDecision
 
struct  PatchInterfaceConflict
 
struct  PatchInterfaceReport
 
struct  PatchLimits
 
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. Quads are emitted CCW. More...
 
class  Polygon
 
struct  QuadBlockGrid
 Local cell size on a regular grid; NaN marks unusable cells. More...
 
struct  QuadBlockOptions
 
struct  QuadPlan
 
struct  QuadPlanningGeometry
 
struct  QuadPlanningOptions
 
struct  QuadQuality
 
struct  QuadQualityBounds
 Acceptance bounds shared by pairing, cleanup, smoothing and the legacy tri-pair merge. Defaults are the plan's (§5): hard 60°/120°, SJ ≥ 0.866, aspect ≤ 2. More...
 
struct  QuadRegion
 
class  ReadArray
 
struct  SimplificationChange
 
struct  SimplificationFeature
 
class  SizeField
 Distance-to-feature field sampled as a max-area function. More...
 
struct  SizeFieldOptions
 
struct  SteinerPoint
 
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. along > 0 resamples every centreline segment to that target spacing (original vertices are kept); 0 = one station per centreline vertex. More...
 
class  Text
 

Typedefs

using Bytes = std::string
 

Enumerations

enum class  PatchDisposition {
  Triangles ,
  Accepted ,
  Repaired ,
  RequiredFailure
}
 
enum class  QuadRegionMode {
  Auto ,
  Mapped ,
  Submapped ,
  Free ,
  TrianglesOnly
}
 

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)
 
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={})
 
ConstraintAuditReport auditMeshConstraints (const Vector< SimplificationFeature > &constraints, const MeshResult &mesh, const ConstraintAuditOptions &options={})
 
ConstraintSimplificationResult simplifyConstraints (const Vector< SimplificationFeature > &features, const ConstraintSimplificationOptions &options={})
 
bool cellIsConvex (const Vector< MeshVertex > &v, const MeshTriangle &c)
 
Text validate (const StructuredPatch &p)
 Input checks. Empty string = valid.
 
Text validate (const SweptPatch &p)
 Check swept input geometry and representable station/cell/boundary counts.
 
Text validate (const PatchMesh &pm)
 Requires finite convex CCW quads, consistently shared cell edges, and one simple boundary matching exactly the outer cell edges. Boundary crossings, remote touches, holes and disconnected pieces are rejected; an indexed boundary check avoids comparing every cell pair. Empty string = valid.
 
Polygon orderedPatchBoundary (const PatchMesh &pm, Text *err=nullptr)
 Validate the complete patch and return its CCW boundary, without a repeated closing vertex. Segment input orientation/order is immaterial. On failure returns an empty ring and sets err.
 
PatchMesh makeTransfinitePatch (const StructuredPatch &p, Text *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 makeSweptPatch (const SweptPatch &p, Text *err=nullptr)
 Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads. 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.
 
PatchMesh makeBankPairPatch (const BankPairPatch &p, Text *err=nullptr)
 Build a conforming strip between two simple, disjoint banks. Rejects ambiguous endpoint pairing, touching/crossing banks, folded cells, unrepresentable station geometry and unsafe subdivision counts.
 
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). 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 makeTransfinitePatchAtStations (const Vector< Vector< Point2 > > &sides, const Text &tag, Text *err=nullptr)
 
PatchMesh makeMappedPatch (const Polygon &ring, const Vector< int > &corners, double h, const Text &tag, Text *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 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. 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.
 
PatchAssessment assessPlannedPatch (const PatchMesh &, const PatchLimits &)
 
QuadPlan planQuadRegions (const Vector< QuadRegion > &, const QuadPlanningGeometry &, const QuadPlanningOptions &={})
 
PatchInterfaceReport auditPatchInterfaces (const MeshResult &, const Vector< MeshEdge > &, double maximumRatio, const std::function< bool()> &cancelled={}, int maximumExamples=64)
 
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 &region, 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 > &regions)
 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
 

Typedef Documentation

◆ Bytes

using meshkit::plan::Bytes = typedef std::string

Enumeration Type Documentation

◆ PatchDisposition

Enumerator
Triangles 
Accepted 
Repaired 
RequiredFailure 

◆ QuadRegionMode

enum class meshkit::plan::QuadRegionMode
strong
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.

Function Documentation

◆ assessPlannedPatch()

PatchAssessment meshkit::plan::assessPlannedPatch ( const PatchMesh &  patch,
const PatchLimits &  limits 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ auditConstraintSimplification()

ConstraintAuditReport meshkit::plan::auditConstraintSimplification ( const Vector< SimplificationFeature > &  original,
const ConstraintSimplificationResult &  candidate,
const ConstraintAuditOptions &  options = {} 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ auditMeshConstraints()

ConstraintAuditReport meshkit::plan::auditMeshConstraints ( const Vector< SimplificationFeature > &  constraints,
const MeshResult &  mesh,
const ConstraintAuditOptions &  options = {} 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ auditPatchInterfaces()

PatchInterfaceReport meshkit::plan::auditPatchInterfaces ( const MeshResult &  mesh,
const Vector< MeshEdge > &  boundaries,
double  maximumRatio,
const std::function< bool()> &  cancelled = {},
int  maximumExamples = 64 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellCornerAngleDeg()

double meshkit::plan::cellCornerAngleDeg ( const Vector< MeshVertex > &  v,
const MeshTriangle &  t,
int  i 
)
inline

Compute the unsigned corner angle of a triangle or quad.

Parameters
[in]vStable vertex storage containing every referenced cell index in range.
[in]tValid cyclic cell, preserved.
[in]iLocal corner in[0,t.vertexCount()), unchecked.
Returns
atan2(abs(cross),dot) angle in degrees[0,180] for finite representable edge products; does not distinguish reflex from convex angle, degeneracy/nonfinite values are not validated. Uses xy only, no allocation, ownership retention or mesh mutation.

Interior angle at corner i of a cell (degrees), triangles and quads.

Here is the call graph for this function:

◆ cellIsConvex()

bool meshkit::plan::cellIsConvex ( const Vector< MeshVertex > &  v,
const MeshTriangle &  c 
)
inline

◆ classifyQuadRegion()

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.

Parameters
[in]ringBorrowed finite valid planar ring, unchanged; normalized CCW/open before evaluating turns.
[out]cornersOptional borrowed vector, cleared first; Mapped success fills four indices into the normalized ring, not necessarily original input positions. Other modes leave it empty.
[in]cornerTolDegFinite nonnegative degree tolerance, default 25. Mapped needs exactly four turns within inclusive 90+/-tolerance and all other absolute turns strictly below tolerance.
[in]rectilinearTolDegFinite nonnegative degree tolerance, default 2. Submapped accepts every absolute turn close to 90 or close to zero (straight-through vertices are allowed).
Returns
Mapped first, otherwise Submapped for rectilinear turns, otherwise Free including <3 corners. Does not validate simplicity, corner metadata, directional mesher feasibility or quality; allocates normalized/turn/output arrays, retains no pointers and changes no input geometry.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeBankPairPatch()

PatchMesh meshkit::plan::makeBankPairPatch ( const BankPairPatch &  p,
Text *  err 
)

Build a conforming strip between two simple, disjoint banks. Rejects ambiguous endpoint pairing, touching/crossing banks, folded cells, unrepresentable station geometry and unsafe subdivision counts.

Build a conforming strip between two finite simple disjoint open banks.

Parameters
[in]pBorrowed 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]errOptional borrowed diagnostic, set on failure, not retained; success clearing is stated below.
Returns
Owned XY-only patch with local-index CCW quads/boundary and copied tag; empty on checked failure. No elevations, source mutation, coordinate conversion, engine/file access or retained inputs. Index capacity checks do not constitute a practical memory budget or allocation-failure handling. err cleared at entry. Pairs ends by minimum total connection length, rejects near ties, canonicalizes bank direction/order, and requires simple outline including connectors. Unions exact normalized arc-vertex fractions so every original bend survives; positive along subdivides using longer bank advance. Rejects unrepresentable fractions/counts/points, folded cells and remote contacts. This is normalized arc correspondence, not a surveyed station match. No source reordering or cancellation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeMappedPatch() [1/2]

PatchMesh meshkit::plan::makeMappedPatch ( const Polygon &  ring,
const Vector< int > &  corners,
double  h,
const Text &  tag,
Text *  err 
)

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.

Choose isotropic subdivision counts from opposite-side arc lengths and build a Coons patch.

Parameters
[in]ringBorrowed finite ring in either winding, unchanged; exact repeated closing point allowed.
[in]cornersBorrowed four strictly increasing indices in original open-ring order, unchanged.
[in]hPositive 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]tagBorrowed copied patch/cell tag, unchanged.
[out]errOptional borrowed diagnostic, set on failure, not retained; success clearing is stated below.
Returns
Owned XY-only patch with local-index CCW quads/boundary and copied tag; empty on checked failure. No elevations, source mutation, coordinate conversion, engine/file access or retained inputs. Index capacity checks do not constitute a practical memory budget or allocation-failure handling. err is cleared at entry, then set on failure. Side geometry/count/final patch checks apply.
Here is the caller graph for this function:

◆ makeMappedPatch() [2/2]

PatchMesh meshkit::plan::makeMappedPatch ( const Polygon &  ring,
const Vector< int > &  corners,
double  hAlong,
double  hAcross,
double  alongAngleDeg,
const Text &  tag,
Text *  err 
)

Mapped patch with independent physical-axis spacing. 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.

Associate physical directional spacings with opposite logical side pairs before Coons generation.

Parameters
[in]ringBorrowed finite cyclic ring, either winding, unchanged; exact closing duplicate allowed.
[in]cornersBorrowed four strictly increasing open-ring indices, unchanged.
[in]hAlongPositive finite target spacing along the selected physical axis, ring horizontal units.
[in]hAcrossPositive finite orthogonal target spacing in same units.
[in]alongAngleDegFinite undirected axis counterclockwise from +x, degrees modulo 180.
[in]tagBorrowed copied tag, unchanged.
[out]errOptional borrowed diagnostic, set on failure, not retained; success clearing is stated below.
Returns
Owned XY-only patch with local-index CCW quads/boundary and copied tag; empty on checked failure. No elevations, source mutation, coordinate conversion, engine/file access or retained inputs. Index capacity checks do not constitute a practical memory budget or allocation-failure handling. Mean squared chord-axis projections choose which side pair receives hAlong; equal scores within 1e-10 reject as ambiguous. Arc lengths set nearest-integer counts. err cleared at entry. Rotation of ring start/winding does not intentionally exchange physical spacings; no CRS/geodesic operations.

◆ makeSweptPatch()

PatchMesh meshkit::plan::makeSweptPatch ( const SweptPatch &  p,
Text *  err 
)

Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads. 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.

Sweep a finite centerline with mitred offsets into a globally validated quad strip.

Parameters
[in]pBorrowed 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]errOptional borrowed diagnostic, set on failure, not retained; success clearing is stated below.
Returns
Owned XY-only patch with local-index CCW quads/boundary and copied tag; empty on checked failure. No elevations, source mutation, coordinate conversion, engine/file access or retained inputs. Index capacity checks do not constitute a practical memory budget or allocation-failure handling. err cleared at entry. Checks counts before allocation, rejects collapsed station geometry, reversals/excessively sharp mitres, nonfinite offsets, invalid cells and remote boundary contacts. No snapping/automatic bend repair, terrain z, callbacks or cancellation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeTransfinitePatch() [1/2]

PatchMesh meshkit::plan::makeTransfinitePatch ( const StructuredPatch &  p,
Text *  err 
)

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.

Generate a bilinear grid between four straight convex sides.

Parameters
[in]pBorrowed cyclic four-corner patch, unchanged, common finite XY frame; n,m>=1 checked.
[out]errOptional borrowed diagnostic, set on failure, not retained; success clearing is stated below.
Returns
Owned XY-only patch with local-index CCW quads/boundary and copied tag; empty on checked failure. No elevations, source mutation, coordinate conversion, engine/file access or retained inputs. Index capacity checks do not constitute a practical memory budget or allocation-failure handling. Produces (n+1)*(m+1) vertices and n*m cells, accepts either corner winding then emits CCW cells. Validates inputs and complete output; err is not cleared on success. No cancellation or terrain sampling.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeTransfinitePatch() [2/2]

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

◆ makeTransfinitePatchAtStations()

PatchMesh meshkit::plan::makeTransfinitePatchAtStations ( const Vector< Vector< Point2 > > &  sides,
const Text &  tag,
Text *  err = nullptr 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeRingCCW()

Polygon meshkit::plan::normalizeRingCCW ( const Polygon &  ring)

Copy a ring while dropping scale-fuzzy consecutive/closing duplicates and reversing negative area.

Parameters
[in]ringBorrowed 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.
Returns
Owned open sequence without closing duplicate, CCW when nondegenerate negative area was reversed. Nonconsecutive duplicate IDs, self-crossings and zero-area/NaN geometry are not repaired or rejected. Allocates output, can remove near-distinct coordinates within tolerance, retains no source references.

Drop a closing duplicate, drop consecutive duplicates, make CCW.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ orderedPatchBoundary()

Polygon meshkit::plan::orderedPatchBoundary ( const PatchMesh &  pm,
Text *  err 
)

Validate the complete patch and return its CCW boundary, without a repeated closing vertex. Segment input orientation/order is immaterial. On failure returns an empty ring and sets err.

Validate a quad patch and extract its ordered open CCW perimeter.

Parameters
[in]pmBorrowed patch, unchanged; full validatePatchMesh checks apply.
[out]errOptional borrowed diagnostic, set on failure, not retained; success clearing is stated below.
Returns
Owned ring without closing duplicate, empty on failure. err is assigned on EVERY call, including cleared to empty on success. Segment input order/orientation is immaterial. No source mutation or retained pointers; allocates validation/index/ring storage.
Here is the caller graph for this function:

◆ placeQuadBlocks()

Vector< QuadRegion > meshkit::plan::placeQuadBlocks ( const QuadBlockGrid &  grid,
const QuadBlockOptions &  options 
)

Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands.

Parameters
[in]gridBorrowed 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]optionsBorrowed policy with finite bandRatio>1, feasible finite minSpacing and positive minQuadsPerSide recommended. maxBlocks<=0 produces no regions; nonpositive minimum spacing does not filter.
Returns
Owned open four-corner Mapped QuadRegions with explicit spacing/corner indices, empty on basic invalid grid/band policy or no eligible rectangles. Processes coarser two-adjacent bands first, up to four candidate passes per band, sorting rectangles largest-first then row/column within a pass. 3/4-cost chamfer/grid exclusion supplies clearance from unusable cells, grid edges and prior blocks; regions shrink to centered whole-spacing dimensions. No exact Euclidean feature clearance or final mesher-quality guarantee is added. Allocates bands/distances/candidate/output storage, retains no inputs and changes no grid/mesh/engine state; no cancellation or explicit resource-failure result.

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ planQuadRegions()

QuadPlan meshkit::plan::planQuadRegions ( const Vector< QuadRegion > &  regions,
const QuadPlanningGeometry &  geometry,
const QuadPlanningOptions &  options = {} 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pointInRegion()

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.

Parameters
[in]ringBorrowed finite planar outer ring, unchanged.
[in]holesBorrowed finite hole rings in the same frame, unchanged; no containment/disjointness validation.
[in]pBorrowed finite point, unchanged.
Returns
True when pointInRing(outer,p) and no pointInRing(hole,p), false otherwise. Exact edge behavior inherits strict crossing semantics, not a uniform distance-inclusive boundary rule. No allocation, geometry repair, source mutation or engine state lookup.

Inside ring and outside every ring of holes — the region's meshable interior. With no holes this is exactly pointInRing().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pointInRing()

bool meshkit::plan::pointInRing ( const Polygon &  ring,
const Point2 &  p 
)

Test a point using a strict horizontal-ray odd-even crossing rule.

Parameters
[in]ringBorrowed finite planar ring, unchanged; scale-fuzzy closing duplicate ignored.
[in]pBorrowed finite query in the same planar units, unchanged.
Returns
Crossing parity, false for fewer than three open entries. Boundary classification follows strict crossings and is not uniformly inclusive; use the separate boundary helper where needed. No topology/finite validation, coordinate conversion, allocation or source mutation.

Odd-even point-in-polygon (closed ring, last == first optional).

Here is the caller graph for this function:

◆ polylineIntersectsRect()

bool meshkit::plan::polylineIntersectsRect ( const Vector< Point2 > &  path,
const Box2 &  rect 
)

Test whether any consecutive path segment meets a normalized closed rectangle.

Parameters
[in]pathBorrowed finite planar coordinates, unchanged; at least two points required, zero-length segments still test as points. Parameter-interval arithmetic must remain representable.
[in]rectBorrowed finite rectangle in the same planar units, unchanged; normalized internally, zero-width/height normalized boxes return false.
Returns
True for any slab-clipped interval with enter<=leave, including boundary/axis-aligned contact, false otherwise. No spatial tolerance, allocation, geometry mutation or CRS conversion.

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quadAcceptable()

bool meshkit::plan::quadAcceptable ( const QuadQuality &  q,
const QuadQualityBounds &  b 
)
inline

Apply inclusive hard angle/Jacobian/aspect limits to a valid convex metric record.

Parameters
[in]qStable metrics with positive finite area and valid ranges, otherwise rejected.
[in]bFinite thresholds, angles degrees, minimum Jacobian and maximum aspect dimensionless; maxAspect<=0 disables aspect cap. Caller chooses meaningful angle/score limits; no automatic clamping.
Returns
False on invalid metric/nonfinite bound or minAngle below floor/maxAngle above ceiling/ Jacobian below floor/active aspect above cap; true otherwise, equality allowed. No metadata mutation, geometric repair, allocation or ownership transfer.

Hard acceptance test (finite valid geometry + convexity + unchanged angle bounds, SJ floor and aspect cap).

Here is the call graph for this function:

◆ quadBlockGridFromField()

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 
)
Here is the caller graph for this function:

◆ quadBlockGridFromMesh()

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.

Parameters
[in]meshBorrowed 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]pitchFinite 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]blockersBorrowed 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.
Returns
Owned row-major grid with unweighted mean triangle equivalent side sqrt(area/(sqrt(3)/4)) in planar units, NaN for blocked/no-sample cells. Triangle contributions use containing centers plus centroid bin, not area-weighted raster coverage. Existing quad bounding-box bins are blocked; feature samples at half-pitch steps mask their bins and 3x3 neighbors. Returns invalid if computed grid exceeds 64 million cells, after integer conversions; this is a cell-count cap, not a total memory-byte ceiling. Allocates sums/counts/masks/output, no source mutation, CRS conversion or engine interaction.

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.

Here is the caller graph for this function:

◆ quadQuality() [1/2]

QuadQuality meshkit::plan::quadQuality ( const Point2 &  a,
const Point2 &  b,
const Point2 &  c,
const Point2 &  d 
)
inline

Measure one quadrilateral using cyclic corners and translation/scale-resistant planar arithmetic.

Parameters
[in]aFirst finite planar corner, used as local origin; same coordinate units as other corners.
[in]bSecond cyclic corner, preserved.
[in]cThird cyclic corner, preserved.
[in]dFourth cyclic corner, preserved; winding may be clockwise or counterclockwise.
Returns
Owned metrics: angles degrees, area squared coordinate units, other scores/ratios dimensionless. Invalid/nonfinite/zero-length or unrepresentable geometry returns default nonconvex metrics; concave or crossed finite geometry can return computed metrics with convex false. No index checks, allocations, coordinate mutation or physical simulation; valid opposite winding shares unsigned quality values.

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quadQuality() [2/2]

QuadQuality meshkit::plan::quadQuality ( const Vector< MeshVertex > &  vertices,
const MeshTriangle &  t 
)
inline

Measure a quad cell through its borrowed vertex records.

Parameters
[in]verticesStable storage containing every t index in range, planar coordinates in common units.
[in]tQuad with four valid indices and v3>=0; triangle or invalid index use is unchecked.
Returns
quadQuality of its four cyclic xy positions, angles degrees/area squared units, invalid geometry nonconvex; z/material metadata ignored. No allocation, ownership retention or mesh mutation.

Metrics for a quad cell of mesh (t.v3 >= 0 required).

Here is the call graph for this function:

◆ quadRegionQualityBounds()

QuadQualityBounds meshkit::plan::quadRegionQualityBounds ( const QuadRegion &  region,
QuadQualityBounds  global 
)
inline

Copy global quality bounds and apply an explicitly nonnegative region aspect override.

Parameters
[in]regionBorrowed 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]globalBounds copied by value, only maxAspect can change.
Returns
Owned resulting bounds; no numeric validation, normalization, geometry access, state mutation or ownership retention. validateQuadRegion() performs the authoring range checks separately.

Resolve Free-region bounds. Only the aspect cap may override the global bounds; negative values inherit and zero explicitly disables it.

◆ quadScore()

double meshkit::plan::quadScore ( const QuadQuality &  q,
const QuadQualityBounds &  b 
)
inline

Rank valid convex quads by Jacobian, rectangularity and a soft aspect penalty.

Parameters
[in]qStable metrics, invalid ranges/nonconvex/nonfinite geometry scores zero.
[in]bFinite bounds; only positive maxAspect affects score, other finite hard thresholds are not applied here. Nonpositive maxAspect disables penalty.
Returns
Dimensionless clamped[0,1] product Jacobian*rectangularity*min(1,maxAspect/aspect) for active aspect cap, zero for invalid metrics/bounds. A positive score does not imply quadAcceptable. Read only, no allocation or smoothing/topology mutation.

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.

Here is the call graph for this function:

◆ resampleRing()

Polygon meshkit::plan::resampleRing ( const Polygon &  ring,
double  h,
double  keepTurnDeg = 0.0 
)

Normalize a ring and insert equal-part subdivisions along all implicit closing edges.

Parameters
[in]ringBorrowed finite planar ring, unchanged; fuzzy duplicates are removed and winding normalized.
[in]hFinite 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]keepTurnDegRetained compatibility parameter in degrees, currently ignored; every normalized original vertex survives regardless of turn.
Returns
Owned CCW/open ring, unchanged normalized input for <3 corners or disabled h. Parts use max(1,round(length/h)), so resulting edges are not guaranteed <=h. No simplification beyond normalization, quality/topology validation, coordinate conversion or source mutation; allocates output storage.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ringIsSimple()

bool meshkit::plan::ringIsSimple ( const Polygon &  ring)

Reject proper nonadjacent edge crossings using plain double orientation signs.

Parameters
[in]ringBorrowed finite planar sequence, unchanged; fuzzy closing duplicate ignored.
Returns
False for fewer than three open entries or a proper crossing, true otherwise. Endpoint touches, collinear overlaps, repeated nonconsecutive coordinates and zero-area degeneracy are not rejected; this is a limited crossing test, not a complete simple-polygon certificate. Quadratic read-only scan, no exact adaptive predicates, allocation or source mutation.

True when ring is simple (no proper self-intersection). O(n²).

Here is the caller graph for this function:

◆ ringSignedArea()

double meshkit::plan::ringSignedArea ( const Polygon &  ring)

Compute oriented shoelace area after translating corners to the first vertex.

Parameters
[in]ringBorrowed finite planar sequence, unchanged; closes implicitly, explicit duplicate allowed.
Returns
Signed squared coordinate units, positive CCW/negative CW, zero for fewer than three points. Translation reduces absolute-origin cancellation but does not validate representable products, polygon simplicity or nonzero area; folded rings can cancel. No allocation or source mutation.

Signed shoelace area (CCW positive).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ringTurnDeg()

double meshkit::plan::ringTurnDeg ( const Polygon &  ring,
int  i 
)

Compute a signed exterior turn at one ring corner using adjacent edge cross/dot products.

Parameters
[in]ringBorrowed finite planar sequence, unchanged; fuzzy closing duplicate excluded.
[in]iCorner index, wrapped cyclically including negative values; modulo/addition must fit int.
Returns
atan2(cross,dot) in degrees, positive CCW/negative CW, zero for fewer than three open entries. Zero-length/nonfinite edge arithmetic is not separately rejected, no allocation or geometry mutation.

Exterior turning angle (degrees, CCW positive) at ring vertex i.

Here is the caller graph for this function:

◆ simplifyConstraints()

ConstraintSimplificationResult meshkit::plan::simplifyConstraints ( const Vector< SimplificationFeature > &  features,
const ConstraintSimplificationOptions &  options = {} 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ triangleScaledJacobian()

double meshkit::plan::triangleScaledJacobian ( const Point2 &  a,
const Point2 &  b,
const Point2 &  c 
)
inline

Compute the minimum orientation-normalized corner sine of a triangle.

Parameters
[in]aFirst planar vertex, finite coordinates and representable differences/products required.
[in]bSecond vertex in same coordinate units.
[in]cThird vertex in same coordinate units, winding may be either direction.
Returns
Dimensionless minimum corner sine capped above at 1, equilateral sqrt(3)/2, zero on a detected zero-length edge. Collinear geometry ordinarily yields zero; no finite-input/overflow validation, so callers must not use this as a general invalid-coordinate classifier. No mutation or allocation.

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.

Here is the call graph for this function:

◆ validate() [1/3]

Text meshkit::plan::validate ( const PatchMesh &  pm)

Requires finite convex CCW quads, consistently shared cell edges, and one simple boundary matching exactly the outer cell edges. Boundary crossings, remote touches, holes and disconnected pieces are rejected; an indexed boundary check avoids comparing every cell pair. Empty string = valid.

Validate complete convex CCW quad patch topology and one simple matching boundary.

Parameters
[in]pmBorrowed local-index patch, unchanged; vertex/cell/boundary counts must fit int.
Returns
Empty on finite coordinates, valid indices/convex positive-area cells, opposite shared-edge directions and one nonintersecting/non-touching closed boundary matching outer edges. Rejects holes, duplicates, remote boundary contacts and disconnected loops. Patch attribute values are not validated; line indices and incident edges are checked. Allocates vertex/edge/boundary index storage; no source mutation, repair, transform or IO.

◆ validate() [2/3]

Text meshkit::plan::validate ( const StructuredPatch &  p)

Input checks. Empty string = valid.

Check four finite convex cyclic corners and representable subdivision products.

Parameters
[in]pBorrowed structured patch, unchanged; corners may use either winding, subdivisions >=1.
Returns
Empty when these prerequisites pass, first owned diagnostic otherwise. Does not generate cells, inspect tag syntax, impose practical memory budget or certify final interpolated arithmetic.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate() [3/3]

Text meshkit::plan::validate ( const SweptPatch &  p)

Check swept input geometry and representable station/cell/boundary counts.

Parameters
[in]pBorrowed patch, unchanged; >=2 finite nonduplicate consecutive centerline vertices, positive finite width, across>=1 and finite nonnegative along spacing required, common XY units.
Returns
Empty on input/count success, first owned diagnostic otherwise. Does not certify offset folding/global overlap; those checks occur after makeSweptPatch generation. May calculate counts, no mesh/source mutation, CRS transform or IO.
Here is the call graph for this function:

◆ validateQuadRegion()

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.

Parameters
[in]rBorrowed 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]domainsBorrowed 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]holesBorrowed 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.
Returns
Owned first English error, empty when these checks pass. Requires >=3 normalized vertices, finite coordinates, no proper self-crossing and positive area; spacing requests require >=four target cells' area (directional includes roundoff allowance). Probe-only containment does not certify every edge or full polygon lies inside domain/outside holes, nor classify Auto into a guaranteed supported mesher. Allocates normalized ring/probes/diagnostics, no source mutation, engine validation or error rollback.

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateQuadRegionsDisjoint()

Text meshkit::plan::validateQuadRegionsDisjoint ( const Vector< QuadRegion > &  regions)

Check explicit region pairs for proper crossings or strictly interior sampled vertices.

Parameters
[in]regionsBorrowed finite region rings, unchanged; normalized to open CCW copies. Call individual validation separately; degenerate <3-corner rings are ignored by overlap testing.
Returns
First English region i overlaps region j using zero-based indices, or empty. Any pair containing a background region is skipped because explicit regions may be subtracted from backgrounds. Shared edges/ vertices are allowed under scale-fuzzy boundary tests. Identical coincident rings can pass because no proper crossing/strictly interior vertex exists, so this is not a full polygon-intersection-area proof. Quadratic pair/edge work with temporary rings, no input mutation, engine query or retained references.

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

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ pi

constexpr double meshkit::plan::pi = 3.141592653589793238462643383279502884
inlineconstexpr