xmsmesh  1.0
xms::MeIntersectPolys::impl Class Reference

Does polygon intersection for MePolyCleaner. More...

Public Member Functions

void SetupInIn (const std::vector< MePolyOffsetterOutput > &a_offsets, double a_xyTol)
 Setup for the InInDoIntersection. More...
 
void SetupInOut (const MePolyOffsetterOutput &a_offsets, double a_xyTol)
 Setup for InOutDoIntersection. More...
 
void InInTrivialPolyCases ()
 Looks for polygons that are completely disjoint based on their envelopes. Also finds polygons that are inside of other polygons. If an INSIDE_POLY is inside of another INSIDE_POLY then it will be deleted. However, it is possible for an INSIDE_POLY to be inside of a NEWOUT_POLY. If this is the case then we don't delete that polygon.
 
void InInDoIntersection ()
 Uses a stack of INSIDE_POLY polygons to intersect the polygons with one another. The stack is sorted by the size of the polygon envelope. The largest envelopes are processed first. If 2 polygons do intersect then a new polygon is formed that is the union of the 2 polygons. The 2 polygons are removed from the stack and the new polygon is put on the front of the stack and intersected with the remaining polygons. If a polygon does not intersect any other polygon then it is removed from the stack and moved to the output.
 
void InOutDoIntersection ()
 A stack is created of INSIDE_POLY polygons. Each of these polygons is checked to see if it intersects with OUTSIDE_POLY polygons. If they intersect then the INSIDE_POLY is subtracted from the OUTSIDE_POLY and the result from that operation can be multiple new OUTSIDE_POLY polygons. The old OUTSIDE_POLY is removed from consideration for intersections and the results from the polygon subtraction are now considered for intersection with other INSIDE_POLY polygons. Any INSIDE_POLY polygon that intersects an OUTSIDE_POLY is deleted. Otherwise the INSIDE_POLY moves to the output.
 
void FillOutput (MePolyOffsetterOutput &a_out)
 Fills the output class. More...
 
void ClassifyPolys (const MePolyOffsetterOutput &a_input, std::vector< std::vector< size_t >> &a_output)
 Classifies the polygons. see PolyClassifierImpl::Classify. More...
 
void OnSetup ()
 Setup member variables. Called by SetupInIn and SetupInOut.
 
void ClassifyDisjointPolys (SetIdx &a_delPolys)
 Classifies polygons that are completely disjoint from other polygons based on the envelopes of the polygons. More...
 
void ClassifyPolysInsideOfPolys (SetIdx &a_delPolys)
 If an INSIDE_POLY is inside of another INSIDE_POLY then it will be deleted. But if it is inside of a NEWOUT_POLY then don't delete it. More...
 
void UpdateInPolyLoopsFromHash (const std::vector< size_t > &a_idx)
 Updates the indexes that define the polygons after the point locations have been hashed to find duplicate locations. More...
 
void InOutCalcStartingStack ()
 Sets up the stack for the InOutDoIntersection method. A stack of INSIDE_POLY polygons is created and sorted by polygon envelope from largest to smallest. A set of OUTSIDE_POLY polygons is created. These are candidates for intersection with the INSIDE_POLY polygons.
 
std::vector< size_t > InOutFindIntersectingPolys (size_t a_poly)
 Finds OUTSIDE_POLY polygons that potentially intersect the INSIDE_POLY "a_poly". Used by InOutDoIntersection. More...
 
void FillPolysInsideOfPolys (std::set< size_t > &a_oPoly, std::set< size_t > &a_psetUsed, std::vector< std::vector< size_t >> &a_output)
 Finds INSIDE_POLY that are inside of NEWOUT_POLY or OUTSIDE_POLY. Used by MeIntersectPolys::impl::ClassifyPolys. More...
 
GmBstPoly3d BoostPoly (size_t a_loopIdx)
 Creates a boost polygon from a vector of point indexes. More...
 
bool BoostPolyUnion (size_t a_i, size_t a_j)
 Performs a union operation on 2 polygons. Used by InInDoIntersection. More...
 
bool BoostPolySubtract (size_t a_i, size_t a_j)
 Performs a subtraction with 2 polygons. Used by InOutDoIntersection. More...
 
void DeleteBad_NEWOUT_POLY (MePolyOffsetterOutput &a_out, const VecPt3d &a_origOutsidePoly)
 deletes NEWOUT_POLY polygons that have points outside of OUTSIDE_POLY polygon More...
 

Public Attributes

MePolyPts m_polyPts
 polygon points class
 
std::vector< std::vector< size_t > > m_loops
 indexes to points that make polygons
 
std::vector< int > m_loopTypes
 type of polygon (OUTSIDE_POLY, INSIDE_POLY, NEWOUT_POLY)
 
std::vector< GmBstBox3dm_envelopes
 extents of polygons
 
std::list< size_t > m_stack
 stack for processing the polygons
 
MePolyOffsetterOutput m_out
 newpolygons created by this class
 
std::vector< GmBstPoly3dm_bPolys
 boost::geometry::polygon
 
std::vector< GmBstPoly3dm_bOutPolys
 boost::geometry::polygon
 
std::vector< int > m_bOutPolyType
 type of polygon (OUTSIDE_POLY, INSIDE_POLY, NEWOUT_POLY)
 
SetIdx m_inOutOpolys
 outside polygons
 
boost::unordered_set< std::pair< size_t, size_t > > m_polyInsideOfPoly
 index of polygon that is inside of another polygon
 

Detailed Description

Does polygon intersection for MePolyCleaner.

Definition at line 53 of file MeIntersectPolys.cpp.

Member Function Documentation

◆ BoostPoly()

GmBstPoly3d xms::MeIntersectPolys::impl::BoostPoly ( size_t  a_loopIdx)

Creates a boost polygon from a vector of point indexes.

Parameters
a_loopIdxIndex to a polygon. The point indexes that make up the polygon will be in the m_loops[m_loopIdx] variable. These indexes refer to locations in the MePolyPts::Pts() vector.
Returns
A boost polygon class.

Definition at line 815 of file MeIntersectPolys.cpp.

◆ BoostPolySubtract()

bool xms::MeIntersectPolys::impl::BoostPolySubtract ( size_t  a_i,
size_t  a_j 
)

Performs a subtraction with 2 polygons. Used by InOutDoIntersection.

Parameters
a_iIndex to a polygon (m_loops[a_i]).
a_jIndex to a polygon (m_loops[a_j]). a_j polygon is subtracted from a_i polygon
Returns
true if the intersection resulted in a new polygon

Definition at line 890 of file MeIntersectPolys.cpp.

References xms::iCalcPolyEnvelope().

◆ BoostPolyUnion()

bool xms::MeIntersectPolys::impl::BoostPolyUnion ( size_t  a_i,
size_t  a_j 
)

Performs a union operation on 2 polygons. Used by InInDoIntersection.

Parameters
a_iIndex to a polygon (m_loops[a_i]).
a_jIndex to a polygon (m_loops[a_j]).
Returns
true if the union resulted in a new polygon.

Definition at line 846 of file MeIntersectPolys.cpp.

References xms::iCalcPolyEnvelope().

◆ ClassifyDisjointPolys()

void xms::MeIntersectPolys::impl::ClassifyDisjointPolys ( SetIdx a_delPolys)

Classifies polygons that are completely disjoint from other polygons based on the envelopes of the polygons.

Parameters
a_delPolysA set of indexes to polygons that have been found to not intersect any other polygons.

Definition at line 651 of file MeIntersectPolys.cpp.

References xms::iEnvelopesOverlap().

◆ ClassifyPolys()

void xms::MeIntersectPolys::impl::ClassifyPolys ( const MePolyOffsetterOutput a_input,
std::vector< std::vector< size_t >> &  a_output 
)

Classifies the polygons. see PolyClassifierImpl::Classify.

Parameters
a_inputInput polygons
a_output2D Vector where the first dimension is the number of "outside" polygons.

Definition at line 617 of file MeIntersectPolys.cpp.

References xms::MePolyOffsetterOutput::m_loops, xms::MePolyOffsetterOutput::m_loopTypes, and xms::MePolyOffsetterOutput::m_pts.

Referenced by xms::MeIntersectPolys::ClassifyPolys(), and MeIntersectPolysUnitTests::testClassify().

◆ ClassifyPolysInsideOfPolys()

void xms::MeIntersectPolys::impl::ClassifyPolysInsideOfPolys ( SetIdx a_delPolys)

If an INSIDE_POLY is inside of another INSIDE_POLY then it will be deleted. But if it is inside of a NEWOUT_POLY then don't delete it.

Parameters
a_delPolysA set of indexes to polygons that have been found to not intersect any other polygons.

Definition at line 693 of file MeIntersectPolys.cpp.

References xms::iEnvelopeInsideOfEnvelope().

◆ DeleteBad_NEWOUT_POLY()

void xms::MeIntersectPolys::impl::DeleteBad_NEWOUT_POLY ( MePolyOffsetterOutput a_out,
const VecPt3d a_origOutsidePoly 
)

deletes NEWOUT_POLY polygons that have points outside of OUTSIDE_POLY polygon

Parameters
a_outHolds the output polygons from the operation performed (either InInDoIntersection or InOutDoIntersection)
a_origOutsidePolyThe outside polygon for this step of the pave operation

Definition at line 919 of file MeIntersectPolys.cpp.

References xms::MePolyOffsetterOutput::m_loops, xms::MePolyOffsetterOutput::m_loopTypes, and xms::MePolyOffsetterOutput::m_pts.

Referenced by xms::MeIntersectPolys::DeleteBad_NEWOUT_POLY().

◆ FillOutput()

void xms::MeIntersectPolys::impl::FillOutput ( MePolyOffsetterOutput a_out)

Fills the output class.

Parameters
a_outHolds the output polygons from the operation performed (either InInDoIntersection or InOutDoIntersection

Definition at line 524 of file MeIntersectPolys.cpp.

References xms::MePolyOffsetterOutput::m_loops, xms::MePolyOffsetterOutput::m_loopTypes, and xms::MePolyOffsetterOutput::m_pts.

Referenced by xms::MeIntersectPolys::FillOutput().

◆ FillPolysInsideOfPolys()

void xms::MeIntersectPolys::impl::FillPolysInsideOfPolys ( std::set< size_t > &  a_oPoly,
std::set< size_t > &  a_psetUsed,
std::vector< std::vector< size_t >> &  a_output 
)

Finds INSIDE_POLY that are inside of NEWOUT_POLY or OUTSIDE_POLY. Used by MeIntersectPolys::impl::ClassifyPolys.

Parameters
a_oPolyA set of indices to "outside" polygons (either NEWOUT_POLY or OUTSIDE_POLY)
a_psetUsedA sect of indices to polygons that have already been classified
a_output2D Vector where the first dimension is the number of "outside" polygons.

Definition at line 584 of file MeIntersectPolys.cpp.

◆ InOutFindIntersectingPolys()

std::vector< size_t > xms::MeIntersectPolys::impl::InOutFindIntersectingPolys ( size_t  a_poly)

Finds OUTSIDE_POLY polygons that potentially intersect the INSIDE_POLY "a_poly". Used by InOutDoIntersection.

Parameters
a_polyIndex to an INSIDE_POLY polygon.
Returns
Vector of polygon indexes for the polys that intersect.

Definition at line 790 of file MeIntersectPolys.cpp.

References xms::iEnvelopesOverlap().

◆ SetupInIn()

void xms::MeIntersectPolys::impl::SetupInIn ( const std::vector< MePolyOffsetterOutput > &  a_offsets,
double  a_xyTol 
)

Setup for the InInDoIntersection.

Parameters
a_offsetsVector of outputs from MePolyOffsetter::Offset. These would be the offsets from paving from OUTSIDE_POLY and INSIDE_POLY polygons.
a_xyToltolerance for floating point comparisons

Definition at line 279 of file MeIntersectPolys.cpp.

References xms::MePolyOffsetterOutput::m_loops, m_loops, xms::MePolyOffsetterOutput::m_loopTypes, m_out, m_polyPts, xms::MePolyOffsetterOutput::m_pts, OnSetup(), xms::MePolyPts::Pts(), and xms::MePolyPts::XyTol().

Referenced by xms::MeIntersectPolys::SetupInIn().

◆ SetupInOut()

void xms::MeIntersectPolys::impl::SetupInOut ( const MePolyOffsetterOutput a_offsets,
double  a_xyTol 
)

Setup for InOutDoIntersection.

Parameters
a_offsetsThe output from MePolyCleaner::IntersectCleanInPolys
a_xyToltolerance for floating point comparisons

Definition at line 376 of file MeIntersectPolys.cpp.

Referenced by xms::MeIntersectPolys::SetupInOut().

◆ UpdateInPolyLoopsFromHash()

void xms::MeIntersectPolys::impl::UpdateInPolyLoopsFromHash ( const std::vector< size_t > &  a_idx)

Updates the indexes that define the polygons after the point locations have been hashed to find duplicate locations.

Parameters
a_idxVector with new indexes based on the hashing of point locations. If there are no duplicates the values would be 0,1,2,3,... If there are duplicates then the values might be 0,1,2,0,2,5,6,0...

Definition at line 741 of file MeIntersectPolys.cpp.


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