OGS
|
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices in the point vector. A polyline consists of at least one line segment. The polyline is specified by the points of the line segments. The class Polyline stores ids of pointers to the points in the _ply_pnt_ids vector.
Definition at line 50 of file Polyline.h.
#include <Polyline.h>
Classes | |
class | SegmentIterator |
Public Member Functions | |
Polyline (const std::vector< Point * > &pnt_vec) | |
Polyline (const Polyline &ply) | |
Polyline & | operator= (Polyline const &other)=delete |
~Polyline () override=default | |
GEOTYPE | getGeoType () const override |
return a geometry type More... | |
virtual bool | addPoint (std::size_t pnt_id) |
virtual bool | insertPoint (std::size_t pos, std::size_t pnt_id) |
virtual void | removePoint (std::size_t pos) |
void | closePolyline () |
std::size_t | getNumberOfPoints () const |
std::size_t | getNumberOfSegments () const |
bool | isClosed () const |
bool | isCoplanar () const |
bool | isPointIDInPolyline (std::size_t pnt_id) const |
std::size_t | getPointID (std::size_t i) const |
void | setPointID (std::size_t idx, std::size_t id) |
const Point * | getPoint (std::size_t i) const |
returns the i-th point contained in the polyline More... | |
SegmentIterator | begin () const |
SegmentIterator | end () const |
std::vector< Point * > const & | getPointsVec () const |
double | getDistanceAlongPolyline (const MathLib::Point3d &pnt, const double epsilon_radius) const |
Public Member Functions inherited from GeoLib::GeoObject | |
virtual | ~GeoObject ()=default |
Static Public Member Functions | |
static Polyline * | constructPolylineFromSegments (const std::vector< Polyline * > &ply_vec, double prox=0.0) |
Protected Member Functions | |
Location | getLocationOfPoint (std::size_t k, MathLib::Point3d const &pnt) const |
Protected Attributes | |
const std::vector< Point * > & | _ply_pnts |
std::vector< std::size_t > | _ply_pnt_ids |
Private Member Functions | |
LineSegment | getSegment (std::size_t i) const |
LineSegment | getSegment (std::size_t i) |
Friends | |
class | Polygon |
|
explicit |
constructor
pnt_vec | a reference to the point vector |
Definition at line 27 of file Polyline.cpp.
Referenced by constructPolylineFromSegments().
GeoLib::Polyline::Polyline | ( | const Polyline & | ply | ) |
|
overridedefault |
|
virtual |
Adds an id of a point at the end of the polyline if and only if the resulting segment won't be empty. The id have to be inside the (internal) _ply_pnts
vector the polyline is based on.
true
. If the addition of the point would result in empty line segment false
is returned. Reimplemented in GeoLib::PolylineWithSegmentMarker, and GeoLib::PolygonWithSegmentMarker.
Definition at line 34 of file Polyline.cpp.
References _ply_pnt_ids, and _ply_pnts.
Referenced by GeoLib::PolygonWithSegmentMarker::addPoint(), GeoLib::PolylineWithSegmentMarker::addPoint(), closePolyline(), createPolyline(), insertPoint(), mergeGeometries(), FileIO::SwmmInterface::readLinksAsPolylines(), FileIO::Legacy::readPolylinePointVector(), GeoLib::rotatePolygonToXY(), and GeoLib::Polygon::splitPolygonAtPoint().
|
inline |
Definition at line 189 of file Polyline.h.
Referenced by GeoLib::computeAndInsertAllIntersectionPoints(), GeoLib::Polygon::getNextIntersectionPointPolygonLine(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPolylineInPolygon(), GeoLib::lineSegmentsIntersect(), and MeshGeoToolsLib::mapPolylineOnSurfaceMesh().
void GeoLib::Polyline::closePolyline | ( | ) |
Closes a polyline by adding a line segment that connects start- and end-point.
Definition at line 299 of file Polyline.cpp.
References addPoint(), ERR(), getNumberOfPoints(), getPointID(), and isClosed().
Referenced by GEOModels::connectPolylineSegments(), and main().
|
static |
Constructs one polyline from a vector of connected polylines. All polylines in this vector need to reference the same point vector.
Definition at line 187 of file Polyline.cpp.
References Polyline(), ERR(), and GeoLib::pointsAreIdentical().
Referenced by GEOModels::connectPolylineSegments().
|
inline |
Definition at line 194 of file Polyline.h.
References getNumberOfSegments().
Referenced by GeoLib::computeAndInsertAllIntersectionPoints(), GeoLib::Polygon::getNextIntersectionPointPolygonLine(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPolylineInPolygon(), GeoLib::lineSegmentsIntersect(), and MeshGeoToolsLib::mapPolylineOnSurfaceMesh().
double GeoLib::Polyline::getDistanceAlongPolyline | ( | const MathLib::Point3d & | pnt, |
const double | epsilon_radius | ||
) | const |
returns the distance along the polyline from the beginning of the polyline
pnt | the point on the polyline |
epsilon_radius | the epsilon |
Definition at line 353 of file Polyline.cpp.
References MathLib::calcProjPntToLineAndDists(), getNumberOfSegments(), getPoint(), and MathLib::LinAlg::norm().
Referenced by MeshGeoToolsLib::MeshNodesAlongPolyline::MeshNodesAlongPolyline().
|
inlineoverridevirtual |
return a geometry type
Implements GeoLib::GeoObject.
Definition at line 107 of file Polyline.h.
References GeoLib::POLYLINE.
|
protected |
2D method - ignores z coordinate. It calculates the location of the point relative to the k-th line segment of the polyline. (literature reference: Computational Geometry and Computer Graphics in C++; Michael J. Laszlo)
k | the number of line segment |
pnt | the point |
Definition at line 312 of file Polyline.cpp.
References _ply_pnt_ids, _ply_pnts, GeoLib::BEHIND, GeoLib::BETWEEN, GeoLib::BEYOND, GeoLib::DESTINATION, GeoLib::LEFT, GeoLib::RIGHT, GeoLib::SOURCE, and MathLib::sqrDist().
Referenced by GeoLib::Polygon::getEdgeType().
std::size_t GeoLib::Polyline::getNumberOfPoints | ( | ) | const |
returns the number of points, the number of segments is about one smaller
Definition at line 99 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by GEOModels::addNameForObjectPoints(), GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), closePolyline(), GeoLib::containsEdge(), GeoLib::EarClippingTriangulation::copyPolygonPoints(), FileIO::createSurface(), FileIO::createSurfaceWithEarClipping(), GeoLib::Polygon::ensureCCWOrientation(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPntInPolygon(), GeoLib::GEOObjects::mergePolylines(), GeoLib::operator==(), GeoLib::rotatePolygonToXY(), and LinearEditDialog::setupDialog().
std::size_t GeoLib::Polyline::getNumberOfSegments | ( | ) | const |
Definition at line 104 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by end(), getDistanceAlongPolyline(), getSegment(), and GeoLib::lineSegmentsIntersect().
const Point * GeoLib::Polyline::getPoint | ( | std::size_t | i | ) | const |
returns the i-th point contained in the polyline
Definition at line 176 of file Polyline.cpp.
References _ply_pnt_ids, and _ply_pnts.
Referenced by GeoTreeModel::addChildren(), GeoLib::EarClippingTriangulation::copyPolygonPoints(), GeoLib::Polygon::ensureCCWOrientation(), getDistanceAlongPolyline(), GeoLib::Polygon::getEdgeType(), isCoplanar(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPntInPolygon(), LinearEditDialog::on_comboBox_currentIndexChanged(), and GeoLib::rotatePolygonToXY().
std::size_t GeoLib::Polyline::getPointID | ( | std::size_t | i | ) | const |
returns the index of the i-th polyline point in the point vector
Definition at line 150 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by GeoLib::EarClippingTriangulation::EarClippingTriangulation(), GeoTreeModel::addChildren(), GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), closePolyline(), GeoLib::containsEdge(), FileIO::createSurface(), mergeGeometries(), GeoLib::GEOObjects::mergePolylines(), GeoLib::operator==(), FileIO::GMSH::GMSHPolygonTree::writeLineLoop(), and FileIO::GMSH::GMSHPolygonTree::writeSubPolygonsAsLineConstraints().
std::vector< Point * > const & GeoLib::Polyline::getPointsVec | ( | ) | const |
Definition at line 182 of file Polyline.cpp.
References _ply_pnts.
Referenced by GeoLib::EarClippingTriangulation::EarClippingTriangulation(), FileIO::createSurface(), FileIO::createSurfaceWithEarClipping(), MeshGeoToolsLib::markNodesOutSideOfPolygon(), and GeoLib::Polygon::splitPolygonAtIntersection().
|
private |
Definition at line 163 of file Polyline.cpp.
References _ply_pnt_ids, _ply_pnts, and getNumberOfSegments().
|
private |
Definition at line 156 of file Polyline.cpp.
References _ply_pnt_ids, _ply_pnts, and getNumberOfSegments().
|
virtual |
Method inserts a new point (that have to be inside the _ply_pnts vector) at the given position in the polyline if and only if the resulting segments won't be empty.
pos | the position in the polyline, pos have to be a value into the interval [0, number of points) |
pnt_id | the id of the new point in the vector of points the polyline is based on |
Reimplemented in GeoLib::PolylineWithSegmentMarker, and GeoLib::PolygonWithSegmentMarker.
Definition at line 51 of file Polyline.cpp.
References _ply_pnt_ids, _ply_pnts, and addPoint().
Referenced by GeoLib::computeAndInsertAllIntersectionPoints(), GeoLib::PolygonWithSegmentMarker::insertPoint(), GeoLib::PolylineWithSegmentMarker::insertPoint(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), and MeshGeoToolsLib::insertSubSegments().
bool GeoLib::Polyline::isClosed | ( | ) | const |
returns true if the polyline is closed
Definition at line 109 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by closePolyline(), FileIO::createSurface(), FileIO::createSurfaceWithEarClipping(), GeoLib::Polygon::initialise(), main(), MeshGeoToolsLib::BoundaryElementsAlongPolyline::modifyEdgeNodeOrdering(), and FileIO::FEFLOWMeshInterface::setMaterialIDs().
bool GeoLib::Polyline::isCoplanar | ( | ) | const |
returns true if the polyline is coplanar
Definition at line 119 of file Polyline.cpp.
References _ply_pnt_ids, DBUG(), getPoint(), and MathLib::isCoplanar().
Referenced by main().
bool GeoLib::Polyline::isPointIDInPolyline | ( | std::size_t | pnt_id | ) | const |
Method tests if the given id of a point (within the vector of points the polyline is based on) is inside the polyline.
pnt_id | the id of the point |
Definition at line 144 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by FileIO::GMSH::GMSHPolygonTree::insertPolyline().
|
virtual |
Method removes a point from the polyline. The connecting line segments will be removed and the length of the polyline will be changed.
pos | a valid position within the polyline |
Definition at line 87 of file Polyline.cpp.
References _ply_pnt_ids.
void GeoLib::Polyline::setPointID | ( | std::size_t | idx, |
std::size_t | id | ||
) |
Changes a point index for one point in a line
idx | Index of point in line |
id | ID of point in PointVec object |
Definition at line 170 of file Polyline.cpp.
References _ply_pnt_ids.
|
friend |
Definition at line 92 of file Polyline.h.
Referenced by GeoLib::Polygon::Polygon(), and GeoLib::Polygon::splitPolygonAtPoint().
|
protected |
position of pointers to the geometric points
Definition at line 227 of file Polyline.h.
Referenced by addPoint(), GeoLib::Polygon::ensureCCWOrientation(), getLocationOfPoint(), getNumberOfPoints(), getNumberOfSegments(), getPoint(), getPointID(), getSegment(), insertPoint(), isClosed(), isCoplanar(), isPointIDInPolyline(), removePoint(), and setPointID().
|
protected |
a reference to the vector of pointers to the geometric points
Definition at line 225 of file Polyline.h.
Referenced by addPoint(), getLocationOfPoint(), getPoint(), getPointsVec(), getSegment(), insertPoint(), and GeoLib::Polygon::splitPolygonAtIntersection().