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
mesh::pslg Namespace Reference

Classes

struct  ConditionReport
 
struct  MinSizePolicy
 Policy for minimum-feature-size conditioning. More...
 
class  PointInRingsIndex
 y-banded odd-even point-in-rings index. More...
 
struct  PreparedRing
 One hole ring after preparation for the PSLG. More...
 
struct  Violation
 

Enumerations

enum class  ViolationCause {
  ShortSegment ,
  CloseFeatures ,
  SmallAngle ,
  SubScaleRing ,
  IdentityMerged
}
 

Functions

QString violationCauseName (ViolationCause c)
 
QVector< ViolationanalyseLocalFeatureSize (const QVector< QPolygonF > &domains, const QVector< QVector< QPointF > > &holeRings, const QVector< ConstraintSegment > &segs, const QVector< SteinerPoint > &pts, double h, int maxReported=200)
 Analyse the PSLG's local feature size. Read-only.
 
bool conditionMinSize (QVector< QPolygonF > *domains, QVector< QVector< QPointF > > *holeRings, QVector< ConstraintSegment > *segs, QVector< SteinerPoint > *pts, const MinSizePolicy &policy, ConditionReport *report, const std::function< bool()> &isCancelled={})
 Condition the PSLG so it can support cells of size policy.minCellSize.
 
QVector< QPointF > simplifyPolyline (const QVector< QPointF > &pts, double epsilon)
 
QVector< QPointF > simplifyRing (const QVector< QPointF > &ring, double epsilon)
 
QVector< QPointF > densifyRing (const QVector< QPointF > &ring, double maxLen)
 
double polylineLength (const QVector< QPointF > &pts)
 
QVector< QPointF > resampleMinLength (const QVector< QPointF > &pts, double minLen, double maxDeviation, int *flaggedOut=nullptr)
 Length-based decimation — the inverse of densifyRing().
 
QVector< QPointF > resampleRingMinLength (const QVector< QPointF > &ring, double minLen, double maxDeviation, int *flaggedOut=nullptr)
 
double ringSignedArea (const QVector< QPointF > &ring)
 
double distSqToSegment (const QPointF &p, const QPointF &a, const QPointF &b)
 
void snapAndDedupe (QVector< mesh::SteinerPoint > &pts, double snapEps)
 
QVector< bool > greedyMinSeparation (const QVector< QPointF > &pts, double minSep)
 Greedy minimum-separation thinning in input order.
 
PreparedRing prepareHoleRing (const QVector< QPointF > &raw, double simplifyEps, double maxEdgeLen)
 
bool prepareHoleRings (const QVector< QVector< QPointF > > &raw, double simplifyEps, double maxEdgeLen, QVector< PreparedRing > *out, const std::function< bool()> &isCancelled={}, const std::function< void(int, int)> &onChunk={}, int *skippedOut=nullptr)
 Prepare many hole rings in parallel (order-preserving).
 

Enumeration Type Documentation

◆ ViolationCause

enum class mesh::pslg::ViolationCause
strong

Why a location cannot support cells of size h.

Enumerator
ShortSegment 

A constrained edge shorter than h.

CloseFeatures 

Two non-incident features within h of each other.

SmallAngle 

Two segments meeting at an angle that forces apex slivers.

SubScaleRing 

A ring (hole or domain notch) narrower than h.

IdentityMerged 

Two coupling identities were merged (opt-in only).

Function Documentation

◆ analyseLocalFeatureSize()

QVector< Violation > mesh::pslg::analyseLocalFeatureSize ( const QVector< QPolygonF > &  domains,
const QVector< QVector< QPointF > > &  holeRings,
const QVector< ConstraintSegment > &  segs,
const QVector< SteinerPoint > &  pts,
double  h,
int  maxReported = 200 
)

Analyse the PSLG's local feature size. Read-only.

Reports the worst maxReported locations where the PSLG cannot support cells of size h, sorted worst-first. This is the diagnostic that justifies (or refutes) conditioning on a given model: if these locations do not coincide with the smallest cells Triangle actually produces, the premise in this file's header is wrong.

Costs one pass over the geometry with a uniform grid at cell size h, so it is cheap enough to run unconditionally for the log line.

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

◆ conditionMinSize()

bool mesh::pslg::conditionMinSize ( QVector< QPolygonF > *  domains,
QVector< QVector< QPointF > > *  holeRings,
QVector< ConstraintSegment > *  segs,
QVector< SteinerPoint > *  pts,
const MinSizePolicy policy,
ConditionReport report,
const std::function< bool()> &  isCancelled = {} 
)

Condition the PSLG so it can support cells of size policy.minCellSize.

Stages, in an order where each one's invariant survives the next:

  1. length resampling of constraint polylines (and rings)
  2. sub-scale path collapse and hole-ring rejection
  3. greedy priority-ordered welding, vertex-edge fix-up, crossing repair, iterated to a fixed point
  4. corner trimming at simple sharp corners

Every pointer argument is modified in place. Returns false ONLY when the fail-safe tripped, in which case all arguments are left exactly as passed and report->conditioningAbandoned is set. A false return is not an error: the caller should log it and generate an unconditioned mesh.

isCancelled is polled between stages and inside the O(n) loops.

Here is the call graph for this function:

◆ densifyRing()

QVector< QPointF > mesh::pslg::densifyRing ( const QVector< QPointF > &  ring,
double  maxLen 
)

Split every ring edge longer than maxLen into equal parts — pure vertex insertion, geometry unchanged. No-op when maxLen <= 0.

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

◆ distSqToSegment()

double mesh::pslg::distSqToSegment ( const QPointF &  p,
const QPointF &  a,
const QPointF &  b 
)

Squared distance from p to the CLOSED segment ab.

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

◆ greedyMinSeparation()

QVector< bool > mesh::pslg::greedyMinSeparation ( const QVector< QPointF > &  pts,
double  minSep 
)

Greedy minimum-separation thinning in input order.

pts[i] is kept iff no already-kept point lies strictly within minSep of it — so input order IS the priority order (earlier points win their neighbourhood). Spatial hash with cell size = minSep and a 3×3 scan, the same idiom as the terrain Poisson-disk filter. Returns one keep flag per point; minSep <= 0 keeps everything.

◆ polylineLength()

double mesh::pslg::polylineLength ( const QVector< QPointF > &  pts)

Total length of the open polyline pts (0 for fewer than 2 points).

Here is the caller graph for this function:

◆ prepareHoleRing()

PreparedRing mesh::pslg::prepareHoleRing ( const QVector< QPointF > &  raw,
double  simplifyEps,
double  maxEdgeLen 
)

Prepare a single hole ring: simplify → validate → densify → seed.

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

◆ prepareHoleRings()

bool mesh::pslg::prepareHoleRings ( const QVector< QVector< QPointF > > &  raw,
double  simplifyEps,
double  maxEdgeLen,
QVector< PreparedRing > *  out,
const std::function< bool()> &  isCancelled = {},
const std::function< void(int, int)> &  onChunk = {},
int *  skippedOut = nullptr 
)

Prepare many hole rings in parallel (order-preserving).

Rings are processed in chunks via QtConcurrent::blockingMapped; between chunks isCancelled is polled and onChunk(done, total) reports progress. out receives one entry per input ring, in input order. Invalid rings are counted into skippedOut. Returns false only when cancelled (out then holds the chunks finished so far).

Here is the call graph for this function:

◆ resampleMinLength()

QVector< QPointF > mesh::pslg::resampleMinLength ( const QVector< QPointF > &  pts,
double  minLen,
double  maxDeviation,
int *  flaggedOut = nullptr 
)

Length-based decimation — the inverse of densifyRing().

Drops intermediate vertices so that every retained chord is at least minLen long, but never moves the polyline further than maxDeviation from its original path: when dropping a run would exceed that, the offending vertex is retained instead and a short segment survives. RDP (simplifyPolyline) cannot do this — it is keyed on perpendicular deviation, so a tight zig-zag keeps every vertex however short the segments.

First and last points are always retained; for a conduit alignment they carry the coupling identity. No-op when minLen <= 0 or size <= 2.

Parameters
flaggedOutoptional; incremented once per short segment that had to be kept because of the deviation cap.
Here is the caller graph for this function:

◆ resampleRingMinLength()

QVector< QPointF > mesh::pslg::resampleRingMinLength ( const QVector< QPointF > &  ring,
double  minLen,
double  maxDeviation,
int *  flaggedOut = nullptr 
)

Closed-ring variant of resampleMinLength(). A closed ring (first == last) stays closed and keeps its orientation — vertices are only ever removed, never reordered. A result degenerating below 3 distinct vertices returns the input unchanged, matching simplifyRing().

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

◆ ringSignedArea()

double mesh::pslg::ringSignedArea ( const QVector< QPointF > &  ring)

Signed area of ring (shoelace / 2). Positive = counter-clockwise. Handles both closed (first == last) and open vertex sequences.

Here is the caller graph for this function:

◆ simplifyPolyline()

QVector< QPointF > mesh::pslg::simplifyPolyline ( const QVector< QPointF > &  pts,
double  epsilon 
)

Simplify an open polyline with RDP. First and last points are always kept. Returns pts unchanged when epsilon <= 0 or pts.size() <= 2.

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

◆ simplifyRing()

QVector< QPointF > mesh::pslg::simplifyRing ( const QVector< QPointF > &  ring,
double  epsilon 
)

Simplify a closed polygon ring with RDP. A closed ring (first == last) stays closed; a result degenerating below 3 vertices returns the input.

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

◆ snapAndDedupe()

void mesh::pslg::snapAndDedupe ( QVector< mesh::SteinerPoint > &  pts,
double  snapEps 
)

Snap near-coincident Steiner points to a grid of cell size snapEps and drop duplicates. Only untagged points (marker == 0) merge; tagged points always survive. Survivor order is preserved.

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

◆ violationCauseName()

QString mesh::pslg::violationCauseName ( ViolationCause  c)