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
editgeometry.cpp File Reference
#include "core/editgeometry.h"
#include <algorithm>
#include <cmath>
#include <limits>
Include dependency graph for editgeometry.cpp:

Namespaces

namespace  EditGeometry
 

Functions

QVector< QPointF > EditGeometry::cleanPolyline (const QVector< QPointF > &v, double tol=kCoincidenceTol)
 Drop consecutive coincident points from a polyline.
 
QVector< QPointF > EditGeometry::cleanPolygonRing (const QVector< QPointF > &v, double tol=kCoincidenceTol)
 Normalize a polygon ring: collapse coincident points and drop a redundant explicit closing vertex.
 
QVector< QPointF > EditGeometry::orientInteriorToEndpoints (QVector< QPointF > interior, const QPointF &from, const QPointF &to)
 Orient a link's interior bend points to run from from toward to.
 
double EditGeometry::polylineLength (const QVector< QPointF > &vertices)
 Compute the total length of a polyline.
 
QVector< QPointF > EditGeometry::replacedAt (const QVector< QPointF > &vertices, int index, const QPointF &newPt)
 Replace one endpoint of a polyline, producing a new vector.
 
QVector< QPointF > EditGeometry::insertedAt (const QVector< QPointF > &vertices, int index, const QPointF &newPt)
 Insert a vertex at index, producing a new polyline of size+1.
 
QVector< QPointF > EditGeometry::removedAt (const QVector< QPointF > &vertices, int index)
 Remove the vertex at index, producing a new polyline of size-1.
 
double EditGeometry::distanceToPolyline (const QVector< QPointF > &vertices, const QPointF &point, int *segmentIndex=nullptr, QPointF *closestPoint=nullptr)
 Distance from a point to the nearest point on a polyline segment.
 
double EditGeometry::polygonArea (const QVector< QPointF > &polygon)
 Compute the area of a polygon using the shoelace formula.
 
double EditGeometry::signedRingArea (const QVector< QPointF > &ring)
 Signed area of a ring via the shoelace formula.
 
bool EditGeometry::pointInRing (const QVector< QPointF > &ring, const QPointF &pt)
 Even-odd point-in-ring test (boundary result is unspecified but stable). Returns false for rings with fewer than 3 vertices.
 
RingPolygon EditGeometry::normalizeRingPolygon (RingPolygon p, double tol=kCoincidenceTol)
 Clean every ring (dedupe + de-close), drop degenerate interior rings, and orient exterior CCW / interiors CW.
 
double EditGeometry::netArea (const RingPolygon &p)
 Net area = |exterior| − Σ|holes|, clamped to >= 0.
 
bool EditGeometry::containsPoint (const RingPolygon &p, const QPointF &pt)
 True when pt is inside the exterior and outside every hole.
 
QPointF EditGeometry::interiorPoint (const QVector< QPointF > &ring)
 A point guaranteed strictly interior to a simple ring — robust for non-convex rings — suitable as a Triangle hole/region seed.
 
RingValidity EditGeometry::validateRingPolygon (const RingPolygon &p)
 Validate a RingPolygon with in-house geometry checks (O(n^2) edge tests; intended for hand-digitized / GIS-sourced rings).
 

Detailed Description