xmsgrid  1.0
GmMultiPolyIntersectionSorterTerse.h
Go to the documentation of this file.
1 #pragma once
2 //------------------------------------------------------------------------------
7 //------------------------------------------------------------------------------
8 
9 //----- Included files ---------------------------------------------------------
10 
11 // 3. Standard Library Headers
12 
13 // 4. External Library Headers
14 
15 // 5. Shared Headers
17 
18 // 6. Non-shared Headers
19 
20 //----- Namespace --------------------------------------------------------------
21 
22 namespace xms {
23 //----- Forward declarations ---------------------------------------------------
24 
25 struct GmMultiPolyIntersectorData;
26 class ix;
27 
28 //----- Classes ----------------------------------------------------------------
29 
33 public:
34  virtual void Sort(GmMultiPolyIntersectorData &a_data,
35  std::vector<int> &polyids, std::vector<double> &tvalues,
36  std::vector<Pt3d> &a_pts, double a_tol) override;
37 
38 private:
40  void RemoveCornerTouches();
41  void RemoveDuplicateEdges();
42  void SwapAdjacents();
43  void AddMissingEndpointIds(const std::vector<int>& a_tChange);
44  void IntersectionsToPolyIdsAndTValuesFor2(std::vector<int> &polyids,
45  std::vector<double> &tvalues,
46  std::vector<Pt3d> &a_pts) const;
47  void
48  IntersectionsToPolyIdsAndTValuesFor3OrMore(std::vector<int> &polyids,
49  std::vector<double> &tvalues,
50  std::vector<Pt3d> &a_pts) const;
51  void IntersectionsToPolyIdsAndTValues(std::vector<int> &polyids,
52  std::vector<double> &tvalues,
53  std::vector<Pt3d> &a_pts) const;
54  void FixArrays(std::vector<int> &polyids, std::vector<double> &tvalues,
55  std::vector<Pt3d> &a_pts) const;
56  void AddToPolyIdsAndTValues(const ix &a_ix, std::vector<int> &polyids,
57  std::vector<double> &tvalues,
58  std::vector<Pt3d> &a_pts) const;
59  void FindPreviousNextNeither(const std::vector<int> &tChange, const int idx,
60  std::vector<int> *inPrev,
61  std::vector<int> *inNext,
62  std::vector<int> *inNeither) const;
63  void Swap(int a, int b);
64  void FindWhereTValuesChange(std::vector<int> &tChange) const;
65 
66 private:
68  *m_d;
69  double m_tol;
70 
71 }; // class GmMultiPolyIntersectionSorterTerse
72 
73 } // namespace xms
void SwapAdjacents()
Swap adjacent identical intersections if necessary.
GmMultiPolyIntersectorData * m_d
Intersection data from GmMultiPolyIntersector.
double m_tol
Tolerance used when comparing t values.
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 value...
An intersection point of a line with a polygon.
void RemoveCornerTouches()
Remove polys that only touch the line at a corner. We try to identify these corner polys using the fo...
void FindWhereTValuesChange(std::vector< int > &tChange) const
Mark where we have a change in t values.
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. ...
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.
void AddMissingEndpointIds(const std::vector< int > &a_tChange)
Add endpoint polygon IDs that may be removed as duplicates.
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.
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...
void FixTValueAtDuplicateXy()
The t-value at the same point should be the same, but it can be off in the floating point representat...
Struct used by GmMultiPolyIntersector.
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.
XMS Namespace.
Definition: geoms.cpp:34
void RemoveDuplicateEdges()
If the line goes along an edge we may have polygons on both sides of the edge. Perhaps we want only t...
void Swap(int a, int b)
Swap the order of the intersections a and b.
Base class for sorting intersections from GmMultiPolyIntersector.
Class for sorting intersections from GmMultiPolyIntersector in a terse way (with no duplicate info)...
void IntersectionsToPolyIdsAndTValues(std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const
Copy intersections to polyids and tvalues, removing duplicates.