xmsmesh
1.0
|
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< GmBstBox3d > | m_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< GmBstPoly3d > | m_bPolys |
boost::geometry::polygon | |
std::vector< GmBstPoly3d > | m_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 | |
Does polygon intersection for MePolyCleaner.
Definition at line 53 of file MeIntersectPolys.cpp.
GmBstPoly3d xms::MeIntersectPolys::impl::BoostPoly | ( | size_t | a_loopIdx | ) |
Creates a boost polygon from a vector of point indexes.
a_loopIdx | Index 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. |
Definition at line 815 of file MeIntersectPolys.cpp.
bool xms::MeIntersectPolys::impl::BoostPolySubtract | ( | size_t | a_i, |
size_t | a_j | ||
) |
Performs a subtraction with 2 polygons. Used by InOutDoIntersection.
a_i | Index to a polygon (m_loops[a_i]). |
a_j | Index to a polygon (m_loops[a_j]). a_j polygon is subtracted from a_i polygon |
Definition at line 890 of file MeIntersectPolys.cpp.
References xms::iCalcPolyEnvelope().
bool xms::MeIntersectPolys::impl::BoostPolyUnion | ( | size_t | a_i, |
size_t | a_j | ||
) |
Performs a union operation on 2 polygons. Used by InInDoIntersection.
a_i | Index to a polygon (m_loops[a_i]). |
a_j | Index to a polygon (m_loops[a_j]). |
Definition at line 846 of file MeIntersectPolys.cpp.
References xms::iCalcPolyEnvelope().
void xms::MeIntersectPolys::impl::ClassifyDisjointPolys | ( | SetIdx & | a_delPolys | ) |
Classifies polygons that are completely disjoint from other polygons based on the envelopes of the polygons.
a_delPolys | A 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().
void xms::MeIntersectPolys::impl::ClassifyPolys | ( | const MePolyOffsetterOutput & | a_input, |
std::vector< std::vector< size_t >> & | a_output | ||
) |
Classifies the polygons. see PolyClassifierImpl::Classify.
a_input | Input polygons |
a_output | 2D 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().
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.
a_delPolys | A 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().
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
a_out | Holds the output polygons from the operation performed (either InInDoIntersection or InOutDoIntersection) |
a_origOutsidePoly | The 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().
void xms::MeIntersectPolys::impl::FillOutput | ( | MePolyOffsetterOutput & | a_out | ) |
Fills the output class.
a_out | Holds 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().
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.
a_oPoly | A set of indices to "outside" polygons (either NEWOUT_POLY or OUTSIDE_POLY) |
a_psetUsed | A sect of indices to polygons that have already been classified |
a_output | 2D Vector where the first dimension is the number of "outside" polygons. |
Definition at line 584 of file MeIntersectPolys.cpp.
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.
a_poly | Index to an INSIDE_POLY polygon. |
Definition at line 790 of file MeIntersectPolys.cpp.
References xms::iEnvelopesOverlap().
void xms::MeIntersectPolys::impl::SetupInIn | ( | const std::vector< MePolyOffsetterOutput > & | a_offsets, |
double | a_xyTol | ||
) |
Setup for the InInDoIntersection.
a_offsets | Vector of outputs from MePolyOffsetter::Offset. These would be the offsets from paving from OUTSIDE_POLY and INSIDE_POLY polygons. |
a_xyTol | tolerance 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().
void xms::MeIntersectPolys::impl::SetupInOut | ( | const MePolyOffsetterOutput & | a_offsets, |
double | a_xyTol | ||
) |
Setup for InOutDoIntersection.
a_offsets | The output from MePolyCleaner::IntersectCleanInPolys |
a_xyTol | tolerance for floating point comparisons |
Definition at line 376 of file MeIntersectPolys.cpp.
Referenced by xms::MeIntersectPolys::SetupInOut().
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.
a_idx | Vector 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.