xmsmesh  1.0
xms::MePolyPts Class Reference

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< implm_p
 implementation class
 

Detailed Description

Utility class to work with polygon paving.

Helper class used by PolyCleaner.

Definition at line 28 of file MePolyPts.h.

Member Function Documentation

◆ CalcLoopsForCleanPolyOffset()

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.

Parameters
a_sequenceList of indexes defining a closed loop polyline. If the polyline intersects with itself then multiple loops are extracted from the polyline.
a_loopsList 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().

◆ CheckIntersectTwoSegs()

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.

Parameters
a_iIndex to a segment.
a_jIndex to a segment.
a_iSegVector of indexes defining a closed loop polyline referred to by a_i
a_jSegVector 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().

◆ ClassifyLoopsFromInPolyAndRemoveInvalid()

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.

Parameters
a_loopsList of vector of indexes defining a closed loop polyline.
a_loopTypeType 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().

◆ HashPts()

std::vector< size_t > xms::MePolyPts::HashPts ( )

Hashes the point locations.

Returns
Vector of new indexes for points.

Definition at line 579 of file MePolyPts.cpp.

References xms::iHashPts(), PtsSharedPointer(), and XyTol().

Referenced by SegmentsForCleanPolyOffset().

◆ IdxFromPt3d()

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.

Parameters
a_ptA location.
Returns
index for a_pt.

Definition at line 848 of file MePolyPts.cpp.

References m_p, and xms::GmPtSearch::New().

◆ IntersectSegs()

void xms::MePolyPts::IntersectSegs ( const std::vector< size_t > &  a_segs)

Intersects the segments.

Parameters
a_segsVector 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().

◆ PolyInsideOfPoly() [1/2]

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.

Parameters
a_polyA polygon used to test a_polyToTest
a_polyToTestVector of indices defining a polygon. Want to determine if it is inside of a_poly.
Returns
true if a_polyToText is inside of a_poly

Definition at line 809 of file MePolyPts.cpp.

References xms::iPolyInsideOfPoly(), and Pts().

◆ PolyInsideOfPoly() [2/2]

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.

Parameters
a_polyVector of points defining a polygon. 1st point repeated at the end of the vector.
a_polyToTestVector of indices defining a polygon. Want to determine if it is inside of a_poly.
Returns
true if a_polyToText is inside of a_poly

Definition at line 830 of file MePolyPts.cpp.

References xms::iPolyInsideOfPoly(), and Pts().

◆ Pts()

◆ PtsSharedPointer()

BSHP< std::vector< Pt3d > > xms::MePolyPts::PtsSharedPointer ( )

Returns the vector of points.

Returns
Shared pointer to vector of points.

Definition at line 571 of file MePolyPts.cpp.

References m_p.

Referenced by HashPts().

◆ RemoveBackwardLoopsForCleanPolyOffset()

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)

Parameters
a_loopsList of vector of indexes defining a closed loop polyline.
a_pTypeType 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().

◆ SegmentsForCleanPolyOffset()

std::vector< size_t > xms::MePolyPts::SegmentsForCleanPolyOffset ( )

Returns the segments that will be used in CleanPolyOffset.

Returns
Segments that will be used in CleanPolyOffset.

Definition at line 589 of file MePolyPts.cpp.

References HashPts(), and Pts().

Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().

◆ SequenceWithIntersects()

std::list< size_t > xms::MePolyPts::SequenceWithIntersects ( std::vector< size_t > &  a_segs)

Returns a new sequence that includes intersection indexes.

Parameters
a_segsList of indexes defining a closed loop polyline.
Returns
a new sequence

Definition at line 629 of file MePolyPts.cpp.

References m_p.

Referenced by xms::MePolyCleanerImpl::CleanPolyOffset().

◆ XyTol()

double & xms::MePolyPts::XyTol ( )

Returns the tolerance.

Returns
the xy tolerance.

Definition at line 555 of file MePolyPts.cpp.

References m_p.

Referenced by CheckIntersectTwoSegs(), xms::MePolyCleanerImpl::CleanPolyOffset(), HashPts(), and xms::MeIntersectPolys::impl::SetupInIn().


The documentation for this class was generated from the following files: