OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::twoD::footprint Namespace Reference

Classes

struct  Point
 

Typedefs

using Ring = std::vector<Point>
 

Functions

double cross (Point a, Point b, Point c)
 Compute the oriented twice-area of a triangle in planar coordinates.
 
double signedArea (const Ring &p)
 Sum a polygon ring's signed triangle-fan area.
 
double tolerance (const Ring &p)
 Derive a scale-relative tolerance for ring cross products and areas.
 
bool between (Point a, Point b, Point p, double eps)
 Test whether a point lies on a closed segment within a cross-product tolerance.
 
bool intersects (Point a, Point b, Point c, Point d, double eps)
 Test closed planar segments for proper crossing or endpoint/collinear contact.
 
std::string triangulate (Ring &p, std::vector< Ring > &triangles, const std::function< bool()> &running={})
 Validate a simple ring and triangulate it by counterclockwise ear clipping.
 
double intersectionArea (Ring subject, const Ring &clip)
 Clip a polygon against a counterclockwise convex ring and return its area.
 

Typedef Documentation

◆ Ring

using openswmm::twoD::footprint::Ring = std::vector<Point>

Function Documentation

◆ between()

bool openswmm::twoD::footprint::between ( Point a,
Point b,
Point p,
double eps )
inline

Test whether a point lies on a closed segment within a cross-product tolerance.

Parameters
[in]aFirst segment endpoint.
[in]bSecond segment endpoint; equality with a is allowed.
[in]pPoint tested against the segment.
[in]epsNonnegative tolerance in squared coordinate units for collinearity only.
Returns
True when the cross-product magnitude is at most eps and both point coordinates are inside the exact endpoint bounds. Bounds are not expanded by eps; inputs are not validated.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cross()

double openswmm::twoD::footprint::cross ( Point a,
Point b,
Point c )
inline

Compute the oriented twice-area of a triangle in planar coordinates.

Parameters
[in]aFirst point, serving as the subtraction origin.
[in]bSecond point.
[in]cThird point.
Returns
Signed cross product (b-a) x (c-a), positive for counterclockwise order, in squared coordinate units (m2 for SI mesh coordinates). No finite-value or degeneracy checks are made.
Here is the caller graph for this function:

◆ intersectionArea()

double openswmm::twoD::footprint::intersectionArea ( Ring subject,
const Ring & clip )
inline

Clip a polygon against a counterclockwise convex ring and return its area.

Parameters
[in]subjectOwned working copy of the subject polygon, implicitly closed. Caller data is unchanged; for general concave footprints, pass each triangle produced by triangulate().
[in]clipStable counterclockwise convex clipping polygon in the same planar coordinate system, with at least three valid vertices for a meaningful polygon intersection.
Returns
Nonnegative clipped area in squared coordinate units. An empty clip performs no clipping and returns the subject area. Winding, convexity, finiteness and topology are unchecked.
Note
Uses exact half-plane sign tests without epsilon. Intermediate polygon allocation may throw; no references to either input survive the call.
Here is the call graph for this function:

◆ intersects()

bool openswmm::twoD::footprint::intersects ( Point a,
Point b,
Point c,
Point d,
double eps )
inline

Test closed planar segments for proper crossing or endpoint/collinear contact.

Parameters
[in]aFirst endpoint of the first segment.
[in]bSecond endpoint of the first segment.
[in]cFirst endpoint of the second segment.
[in]dSecond endpoint of the second segment.
[in]epsNonnegative cross-product tolerance in squared coordinate units.
Returns
True for opposite-sided crossings beyond eps or a between() contact; false otherwise. Finite coordinates are assumed. No allocation or mutation occurs.
Here is the call graph for this function:

◆ signedArea()

double openswmm::twoD::footprint::signedArea ( const Ring & p)
inline

Sum a polygon ring's signed triangle-fan area.

Parameters
[in]pStable planar vertices, implicitly closed; a repeated final vertex is permitted.
Returns
Signed area in squared coordinate units, positive for counterclockwise winding, or zero for fewer than three vertices. Self intersections and nonfinite coordinates are unchecked; simple-ring validation belongs to triangulate(). No allocation or input mutation occurs.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tolerance()

double openswmm::twoD::footprint::tolerance ( const Ring & p)
inline

Derive a scale-relative tolerance for ring cross products and areas.

Parameters
[in]pPlanar ring; coordinates should be finite. Extent is measured relative to its first vertex using the largest absolute coordinate offset.
Returns
128 machine epsilons times max(span squared, 1e-24), or zero for an empty ring, in squared coordinate units. The lower floor is absolute, so coordinate-unit changes affect it.

◆ triangulate()

std::string openswmm::twoD::footprint::triangulate ( Ring & p,
std::vector< Ring > & triangles,
const std::function< bool()> & running = {} )
inline

Validate a simple ring and triangulate it by counterclockwise ear clipping.

Parameters
[in,out]pFinite planar polygon. An exact repeated closing vertex is removed, clockwise order is reversed and collinear boundary vertices may be erased. These changes can survive a later failure; holes and multipart rings are unsupported.
[out]trianglesCleared immediately, then populated with owned three-point rings in p's coordinate units. Cancellation or triangulation failure can leave a partial triangulation.
[in]runningOptional synchronous continuation callback; false cancels validation or the ear loop. The callback is not retained; its exceptions propagate.
Returns
Empty string on success; otherwise a diagnostic for missing/nonfinite/duplicate, self-intersecting or degenerate geometry, cancellation or failure to find an ear.
Note
Allocation exceptions propagate. Output must not alias p through an element of triangles; the method supplies no rollback and requires exclusive access to both mutable containers.