xmsgrid
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 | FixTValueAtDuplicateXy () |
The t-value at the same point should be the same, but it can be off in the floating point representation. This makes them the same to prevent too many points from being removed in RemoveCornerTouches. | |
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 | AddMissingEndpointIds (const std::vector< int > &a_tChange) |
Add endpoint polygon IDs that may be removed as duplicates. More... | |
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 31 of file GmMultiPolyIntersectionSorterTerse.h.
|
private |
Add endpoint polygon IDs that may be removed as duplicates.
a_tChange | indexes of t-value changes. |
Definition at line 269 of file GmMultiPolyIntersectionSorterTerse.cpp.
References m_d, xms::GmMultiPolyIntersectorData::m_ixs, xms::GmMultiPolyIntersectorData::m_polys1, xms::GmMultiPolyIntersectorData::m_polys2, and XM_ENSURE_TRUE_NO_ASSERT.
Referenced by RemoveCornerTouches().
|
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 490 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 510 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 571 of file GmMultiPolyIntersectionSorterTerse.cpp.
References 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 449 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 416 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 303 of file GmMultiPolyIntersectionSorterTerse.cpp.
References AddToPolyIdsAndTValues(), 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 334 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 115 of file GmMultiPolyIntersectionSorterTerse.cpp.
References AddMissingEndpointIds(), FindPreviousNextNeither(), FindWhereTValuesChange(), FixTValueAtDuplicateXy(), 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 64 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 562 of file GmMultiPolyIntersectionSorterTerse.cpp.
References m_d, and xms::GmMultiPolyIntersectorData::m_ixs.
Referenced by SwapAdjacents().