|
xmsgeom
1.0
|
Class for sorting intersections from GmMultiPolyIntersector in a terse way (with no duplicate info). More...
Public Member Functions | |
| virtual void | Sort (GmMultiPolyIntersectorData &a_data, std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts, double a_tol) override |
| Sort the intersections, remove redundant info. More... | |
Private Member Functions | |
| void | RemoveCornerTouches () |
| Remove polys that only touch the line at a corner. We try to identify these corner polys using the following criteria: More... | |
| void | RemoveDuplicateEdges () |
| If the line goes along an edge we may have polygons on both sides of the edge. Perhaps we want only the polygons on one side .... ? | |
| void | SwapAdjacents () |
| Swap adjacent identical intersections if necessary. | |
| void | IntersectionsToPolyIdsAndTValuesFor2 (std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const |
| Copy intersections to polyids and tvalues when there are 2 intersections. More... | |
| void | IntersectionsToPolyIdsAndTValuesFor3OrMore (std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const |
| Copy intersections to polyids and tvalues when there are 3 or more intersections. More... | |
| void | IntersectionsToPolyIdsAndTValues (std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const |
| Copy intersections to polyids and tvalues, removing duplicates. More... | |
| void | FixArrays (std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const |
| Make sure we always have at least two tvalues, an entrance and an exit, and that the last polyid = -1. More... | |
| void | AddToPolyIdsAndTValues (const ix &a_ix, std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const |
| Add the intersection info to the arrays. More... | |
| void | FindPreviousNextNeither (const std::vector< int > &tChange, const int idx, std::vector< int > *inPrev, std::vector< int > *inNext, std::vector< int > *inNeither) const |
| Look at each poly in this set of t values and see if it exists in the previous or next set of t values. More... | |
| void | Swap (int a, int b) |
| Swap the order of the intersections a and b. More... | |
| void | FindWhereTValuesChange (std::vector< int > &tChange) const |
| Mark where we have a change in t values. More... | |
Private Attributes | |
| GmMultiPolyIntersectorData * | m_d |
| Intersection data from GmMultiPolyIntersector. | |
| double | m_tol |
| Tolerance used when comparing t values. | |
Class for sorting intersections from GmMultiPolyIntersector in a terse way (with no duplicate info).
This class removes corner touches, duplicate edges (by keeping the one on the right), and, ... well it's hard to define what it does here but suffice it to say that it causes all the unit tests in GmMultiPolyIntersector.cpp to pass.
Definition at line 32 of file GmMultiPolyIntersectionSorterTerse.h.
|
private |
Add the intersection info to the arrays.
| [in] | a_ix | Intersection info. |
| [in,out] | polyids | Intersected polygons. |
| [in,out] | tvalues | Percent distance (0.0 - 1.0) from beginning of line segment to each intersection. |
| [in,out] | a_pts | Points of intersection. |
Definition at line 405 of file GmMultiPolyIntersectionSorterTerse.cpp.
References xms::ix::m_i, xms::ix::m_pt, and xms::ix::m_t.
Referenced by IntersectionsToPolyIdsAndTValuesFor2(), and IntersectionsToPolyIdsAndTValuesFor3OrMore().
|
private |
Look at each poly in this set of t values and see if it exists in the previous or next set of t values.
| tChange | |
| idx | index |
| inPrev | = indices into m_ix of intersections in this group that also appear in the previous group. |
| inNext | = indices into m_ix of intersections in this group that also appear in the next group. |
| inNeither | = indices into m_ix of intersections in this group that don't appear in the previous or next group. |
Definition at line 425 of file GmMultiPolyIntersectionSorterTerse.cpp.
References m_d, and xms::GmMultiPolyIntersectorData::m_ixs.
Referenced by IntersectionsToPolyIdsAndTValuesFor3OrMore(), RemoveCornerTouches(), and RemoveDuplicateEdges().
|
private |
Mark where we have a change in t values.
| tChange | Where tvalues change. |
Definition at line 486 of file GmMultiPolyIntersectionSorterTerse.cpp.
References xms::EQ_TOL(), m_d, xms::GmMultiPolyIntersectorData::m_ixs, and m_tol.
Referenced by IntersectionsToPolyIdsAndTValuesFor3OrMore(), RemoveCornerTouches(), and RemoveDuplicateEdges().
|
private |
Make sure we always have at least two tvalues, an entrance and an exit, and that the last polyid = -1.
| polyids | Poly IDs. |
| tvalues | tvalues. |
| a_pts | Point list. |
Definition at line 364 of file GmMultiPolyIntersectionSorterTerse.cpp.
References m_d, xms::GmMultiPolyIntersectorData::m_polys2, and XM_ENSURE_TRUE_VOID_NO_ASSERT.
Referenced by Sort().
|
private |
Copy intersections to polyids and tvalues, removing duplicates.
| polyids | Poly IDs. |
| tvalues | tvalues. |
| a_pts | Points. |
Definition at line 331 of file GmMultiPolyIntersectionSorterTerse.cpp.
References IntersectionsToPolyIdsAndTValuesFor2(), IntersectionsToPolyIdsAndTValuesFor3OrMore(), m_d, xms::GmMultiPolyIntersectorData::m_ixs, and XM_ENSURE_TRUE_VOID_NO_ASSERT.
Referenced by Sort().
|
private |
Copy intersections to polyids and tvalues when there are 2 intersections.
| polyids | Poly IDs. |
| tvalues | tvalues. |
| a_pts | Points. |
Definition at line 218 of file GmMultiPolyIntersectionSorterTerse.cpp.
References AddToPolyIdsAndTValues(), xms::EQ_EPS(), m_d, xms::GmMultiPolyIntersectorData::m_ixs, xms::GmMultiPolyIntersectorData::m_polys1, and xms::GmMultiPolyIntersectorData::m_polys2.
Referenced by IntersectionsToPolyIdsAndTValues().
|
private |
Copy intersections to polyids and tvalues when there are 3 or more intersections.
| polyids | Poly IDs. |
| tvalues | tvalues. |
| a_pts | Points. |
Definition at line 249 of file GmMultiPolyIntersectionSorterTerse.cpp.
References AddToPolyIdsAndTValues(), FindPreviousNextNeither(), FindWhereTValuesChange(), m_d, xms::GmMultiPolyIntersectorData::m_ixs, and XM_ENSURE_TRUE_VOID_NO_ASSERT.
Referenced by IntersectionsToPolyIdsAndTValues().
|
private |
Remove polys that only touch the line at a corner. We try to identify these corner polys using the following criteria:
Definition at line 83 of file GmMultiPolyIntersectionSorterTerse.cpp.
References FindPreviousNextNeither(), FindWhereTValuesChange(), m_d, xms::GmMultiPolyIntersectorData::m_ixs, and XM_ENSURE_TRUE_VOID_NO_ASSERT.
Referenced by Sort().
|
overridevirtual |
Sort the intersections, remove redundant info.
| [in,out] | a_data | The intersection data from GmMultiPolyIntersector. |
| [out] | polyids | Intersected polygons. |
| [out] | tvalues | Percent distance (0.0 - 1.0) from segment starting location to all intersections. |
| [out] | a_pts | Points of intersection. |
| [in] | a_tol | Tolerance used when comparing t values. |
Definition at line 65 of file GmMultiPolyIntersectionSorterTerse.cpp.
References FixArrays(), IntersectionsToPolyIdsAndTValues(), m_d, m_tol, RemoveCornerTouches(), RemoveDuplicateEdges(), and SwapAdjacents().
|
private |
Swap the order of the intersections a and b.
| [in] | a | An intersection. |
| [in] | b | An intersection. |
Definition at line 477 of file GmMultiPolyIntersectionSorterTerse.cpp.
References m_d, and xms::GmMultiPolyIntersectorData::m_ixs.
Referenced by SwapAdjacents().