xmsmesh
1.0
|
Utility class to work with polygon paving. More...
#include <MePolyPts.h>
Classes | |
class | impl |
Implementation of MePolyPts. More... | |
Public Member Functions | |
MePolyPts () | |
constructor | |
double & | XyTol () |
Returns the tolerance. More... | |
std::vector< Pt3d > & | Pts () |
Returns the vector of points. More... | |
BSHP< std::vector< Pt3d > > | PtsSharedPointer () |
Returns the vector of points. More... | |
std::vector< size_t > | HashPts () |
Hashes the point locations. More... | |
std::vector< size_t > | SegmentsForCleanPolyOffset () |
Returns the segments that will be used in CleanPolyOffset. More... | |
void | IntersectSegs (const std::vector< size_t > &a_segs) |
Intersects the segments. More... | |
std::list< size_t > | SequenceWithIntersects (std::vector< size_t > &a_segs) |
Returns a new sequence that includes intersection indexes. More... | |
void | CheckIntersectTwoSegs (size_t a_i, size_t a_j, const std::vector< size_t > &a_iSeg, const std::vector< size_t > &a_jSeg) |
Intersects 2 segments. More... | |
void | CalcLoopsForCleanPolyOffset (std::list< size_t > &a_sequence, std::list< std::vector< size_t >> &a_loops) |
Calculates new loops from a sequence that has intersections included. More... | |
void | RemoveBackwardLoopsForCleanPolyOffset (std::list< std::vector< size_t >> &a_loops, int a_pType) |
Removes loops that are "backwards" for CleanPolyOffset. "backwards" depends on the type of input (OUTSIDE_POLY or INSIDE_POLY) More... | |
void | ClassifyLoopsFromInPolyAndRemoveInvalid (std::list< std::vector< size_t >> &a_loops, std::vector< int > &a_loopType) |
Classifies loops extracted from a pave on an INSIDE_POLY and removes invalid loops. There are more rules when dealing with paving outward from polygons. Sometimes paving outward will create a new "outside" polygon that we then pave inward on the next step in the algorithm. See testCase8. You can also generate "inside" polygons that are inside of other "inside" polygons. These are deleted. Again see testCase8. More... | |
bool | PolyInsideOfPoly (const std::vector< size_t > &a_poly, const std::vector< size_t > &a_polyToTest) |
Returns true if a_polyToTest is inside of a_poly. More... | |
bool | PolyInsideOfPoly (const std::vector< Pt3d > &a_poly, const std::vector< size_t > &a_polyToTest) |
Returns true if a_polyToTest is inside of a_poly. More... | |
size_t | IdxFromPt3d (const Pt3d &a_pt) |
Returns the index of a location by hashing that location with the current list of points. If the location does not exist yet then it is added to the list of points. More... | |
Private Attributes | |
BSHP< impl > | m_p |
implementation class | |
Utility class to work with polygon paving.
Helper class used by PolyCleaner.
Definition at line 28 of file MePolyPts.h.
void xms::MePolyPts::CalcLoopsForCleanPolyOffset | ( | std::list< size_t > & | a_sequence, |
std::list< std::vector< size_t >> & | a_loops | ||
) |
Calculates new loops from a sequence that has intersections included.
a_sequence | List of indexes defining a closed loop polyline. If the polyline intersects with itself then multiple loops are extracted from the polyline. |
a_loops | List of vector of indexes defining a closed loop polyline. These are extracted from a_sequence |
Definition at line 676 of file MePolyPts.cpp.
References xms::iRemoveRepeatedSegmentFromSequence().
Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().
void xms::MePolyPts::CheckIntersectTwoSegs | ( | size_t | a_i, |
size_t | a_j, | ||
const std::vector< size_t > & | a_iSeg, | ||
const std::vector< size_t > & | a_jSeg | ||
) |
Intersects 2 segments.
a_i | Index to a segment. |
a_j | Index to a segment. |
a_iSeg | Vector of indexes defining a closed loop polyline referred to by a_i |
a_jSeg | Vector of indexes defining a closed loop polyline referred to by a_j |
Definition at line 661 of file MePolyPts.cpp.
References xms::iCheckIntersection(), m_p, and XyTol().
Referenced by IntersectSegs().
void xms::MePolyPts::ClassifyLoopsFromInPolyAndRemoveInvalid | ( | std::list< std::vector< size_t >> & | a_loops, |
std::vector< int > & | a_loopType | ||
) |
Classifies loops extracted from a pave on an INSIDE_POLY and removes invalid loops. There are more rules when dealing with paving outward from polygons. Sometimes paving outward will create a new "outside" polygon that we then pave inward on the next step in the algorithm. See testCase8. You can also generate "inside" polygons that are inside of other "inside" polygons. These are deleted. Again see testCase8.
a_loops | List of vector of indexes defining a closed loop polyline. |
a_loopType | Type of polygon defined in a_loops. |
Definition at line 750 of file MePolyPts.cpp.
References xms::iCalcPolyAreas(), xms::iFindPolysInsideOfOtherPolys(), and Pts().
Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().
std::vector< size_t > xms::MePolyPts::HashPts | ( | ) |
Hashes the point locations.
Definition at line 579 of file MePolyPts.cpp.
References xms::iHashPts(), PtsSharedPointer(), and XyTol().
Referenced by SegmentsForCleanPolyOffset().
size_t xms::MePolyPts::IdxFromPt3d | ( | const Pt3d & | a_pt | ) |
Returns the index of a location by hashing that location with the current list of points. If the location does not exist yet then it is added to the list of points.
a_pt | A location. |
Definition at line 848 of file MePolyPts.cpp.
References m_p, and xms::GmPtSearch::New().
void xms::MePolyPts::IntersectSegs | ( | const std::vector< size_t > & | a_segs | ) |
Intersects the segments.
a_segs | Vector of indexes defining segments. |
Definition at line 607 of file MePolyPts.cpp.
References CheckIntersectTwoSegs(), xms::iCalcSegEnvelopes(), xms::iEnvelopesOverlapOrTouch(), and Pts().
Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().
bool xms::MePolyPts::PolyInsideOfPoly | ( | const std::vector< size_t > & | a_poly, |
const std::vector< size_t > & | a_polyToTest | ||
) |
Returns true if a_polyToTest is inside of a_poly.
a_poly | A polygon used to test a_polyToTest |
a_polyToTest | Vector of indices defining a polygon. Want to determine if it is inside of a_poly. |
Definition at line 809 of file MePolyPts.cpp.
References xms::iPolyInsideOfPoly(), and Pts().
bool xms::MePolyPts::PolyInsideOfPoly | ( | const std::vector< Pt3d > & | a_poly, |
const std::vector< size_t > & | a_polyToTest | ||
) |
Returns true if a_polyToTest is inside of a_poly.
a_poly | Vector of points defining a polygon. 1st point repeated at the end of the vector. |
a_polyToTest | Vector of indices defining a polygon. Want to determine if it is inside of a_poly. |
Definition at line 830 of file MePolyPts.cpp.
References xms::iPolyInsideOfPoly(), and Pts().
std::vector< Pt3d > & xms::MePolyPts::Pts | ( | ) |
Returns the vector of points.
Definition at line 563 of file MePolyPts.cpp.
References m_p.
Referenced by xms::MeIntersectPolys::CalcEnvelopes(), ClassifyLoopsFromInPolyAndRemoveInvalid(), xms::MePolyCleanerImpl::CleanPolyOffset(), xms::iFindPolysInsideOfOtherPolys(), IntersectSegs(), PolyInsideOfPoly(), RemoveBackwardLoopsForCleanPolyOffset(), SegmentsForCleanPolyOffset(), and xms::MeIntersectPolys::impl::SetupInIn().
Returns the vector of points.
Definition at line 571 of file MePolyPts.cpp.
References m_p.
Referenced by HashPts().
void xms::MePolyPts::RemoveBackwardLoopsForCleanPolyOffset | ( | std::list< std::vector< size_t >> & | a_loops, |
int | a_pType | ||
) |
Removes loops that are "backwards" for CleanPolyOffset. "backwards" depends on the type of input (OUTSIDE_POLY or INSIDE_POLY)
a_loops | List of vector of indexes defining a closed loop polyline. |
a_pType | Type of polygon that was offset either OUTSIDE_POLY or INSIDE_POLY. |
Definition at line 722 of file MePolyPts.cpp.
References xms::iCalcPolyAreas(), and Pts().
Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().
std::vector< size_t > xms::MePolyPts::SegmentsForCleanPolyOffset | ( | ) |
Returns the segments that will be used in CleanPolyOffset.
Definition at line 589 of file MePolyPts.cpp.
References HashPts(), and Pts().
Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().
std::list< size_t > xms::MePolyPts::SequenceWithIntersects | ( | std::vector< size_t > & | a_segs | ) |
Returns a new sequence that includes intersection indexes.
a_segs | List of indexes defining a closed loop polyline. |
Definition at line 629 of file MePolyPts.cpp.
References m_p.
Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().
double & xms::MePolyPts::XyTol | ( | ) |
Returns the tolerance.
Definition at line 555 of file MePolyPts.cpp.
References m_p.
Referenced by CheckIntersectTwoSegs(), xms::MePolyCleanerImpl::CleanPolyOffset(), HashPts(), and xms::MeIntersectPolys::impl::SetupInIn().