xmsgeom  1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
GmMultiPolyIntersectionSorterTerse.h
Go to the documentation of this file.
1 #pragma once
2 //------------------------------------------------------------------------------
8 //------------------------------------------------------------------------------
9 
10 //----- Included files ---------------------------------------------------------
11 
12 // 3. Standard Library Headers
13 
14 // 4. External Library Headers
15 
16 // 5. Shared Headers
18 
19 // 6. Non-shared Headers
20 
21 //----- Namespace --------------------------------------------------------------
22 
23 namespace xms {
24 //----- Forward declarations ---------------------------------------------------
25 
26 struct GmMultiPolyIntersectorData;
27 class ix;
28 
29 //----- Classes ----------------------------------------------------------------
30 
34 public:
35  virtual void Sort(GmMultiPolyIntersectorData &a_data,
36  std::vector<int> &polyids, std::vector<double> &tvalues,
37  std::vector<Pt3d> &a_pts, double a_tol) override;
38 
39 private:
40  void RemoveCornerTouches();
41  void RemoveDuplicateEdges();
42  void SwapAdjacents();
43  void IntersectionsToPolyIdsAndTValuesFor2(std::vector<int> &polyids,
44  std::vector<double> &tvalues,
45  std::vector<Pt3d> &a_pts) const;
46  void
47  IntersectionsToPolyIdsAndTValuesFor3OrMore(std::vector<int> &polyids,
48  std::vector<double> &tvalues,
49  std::vector<Pt3d> &a_pts) const;
50  void IntersectionsToPolyIdsAndTValues(std::vector<int> &polyids,
51  std::vector<double> &tvalues,
52  std::vector<Pt3d> &a_pts) const;
53  void FixArrays(std::vector<int> &polyids, std::vector<double> &tvalues,
54  std::vector<Pt3d> &a_pts) const;
55  void AddToPolyIdsAndTValues(const ix &a_ix, std::vector<int> &polyids,
56  std::vector<double> &tvalues,
57  std::vector<Pt3d> &a_pts) const;
58  void FindPreviousNextNeither(const std::vector<int> &tChange, const int idx,
59  std::vector<int> *inPrev,
60  std::vector<int> *inNext,
61  std::vector<int> *inNeither) const;
62  void Swap(int a, int b);
63  void FindWhereTValuesChange(std::vector<int> &tChange) const;
64 
65 private:
67  *m_d;
68  double m_tol;
69 
70 }; // class GmMultiPolyIntersectionSorterTerse
71 
72 } // namespace xms
void SwapAdjacents()
Swap adjacent identical intersections if necessary.
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 IntersectionsToPolyIdsAndTValues(std::vector< int > &polyids, std::vector< double > &tvalues, std::vector< Pt3d > &a_pts) const
Copy intersections to polyids and tvalues, removing duplicates.
GmMultiPolyIntersectorData * m_d
Intersection data from GmMultiPolyIntersector.
double m_tol
Tolerance used when comparing t values.
An intersection point of a line with a polygon.
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 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...
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 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.
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.
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 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. ...