xmsmesh  1.0
MePolyPts.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
6 //------------------------------------------------------------------------------
7 #pragma once
8 
9 //----- Included files ---------------------------------------------------------
10 #include <list>
11 #include <set>
12 #include <vector>
13 #include <xmscore/points/pt.h>
15 
16 //----- Forward declarations ---------------------------------------------------
17 
18 //----- Namespace declaration --------------------------------------------------
19 namespace xms
20 {
21 // typedef boost::unordered_set<size_t> setIdx;
22 typedef std::set<size_t> SetIdx;
23 
24 //----- Constants / Enumerations -----------------------------------------------
25 
26 //----- Structs / Classes ------------------------------------------------------
28 class MePolyPts
29 {
30 public:
31  MePolyPts();
32 
33  double& XyTol();
34  // Pt3d &Offset();
35  std::vector<Pt3d>& Pts();
36  BSHP<std::vector<Pt3d>> PtsSharedPointer();
37 
38  std::vector<size_t> HashPts();
39  std::vector<size_t> SegmentsForCleanPolyOffset();
40  void IntersectSegs(const std::vector<size_t>& a_segs);
41  std::list<size_t> SequenceWithIntersects(std::vector<size_t>& a_segs);
42  void CheckIntersectTwoSegs(size_t a_i,
43  size_t a_j,
44  const std::vector<size_t>& a_iSeg,
45  const std::vector<size_t>& a_jSeg);
46  void CalcLoopsForCleanPolyOffset(std::list<size_t>& a_sequence,
47  std::list<std::vector<size_t>>& a_loops);
48  void RemoveBackwardLoopsForCleanPolyOffset(std::list<std::vector<size_t>>& a_loops, int a_pType);
49  void ClassifyLoopsFromInPolyAndRemoveInvalid(std::list<std::vector<size_t>>& a_loops,
50  std::vector<int>& a_loopType);
51 
52  bool PolyInsideOfPoly(const std::vector<size_t>& a_poly, const std::vector<size_t>& a_polyToTest);
53  bool PolyInsideOfPoly(const std::vector<Pt3d>& a_poly, const std::vector<size_t>& a_polyToTest);
54  size_t IdxFromPt3d(const Pt3d& a_pt);
55 
56 private:
57  class impl;
58  BSHP<impl> m_p;
59 };
60 
61 //----- Function prototypes ----------------------------------------------------
62 
63 } // namespace xms
void ClassifyLoopsFromInPolyAndRemoveInvalid(std::list< std::vector< size_t >> &a_loops, std::vector< int > &a_loopType)
Classifies loops extracted from a pave on an INSIDE_POLY and removes invalid loops. There are more rules when dealing with paving outward from polygons. Sometimes paving outward will create a new "outside" polygon that we then pave inward on the next step in the algorithm. See testCase8. You can also generate "inside" polygons that are inside of other "inside" polygons. These are deleted. Again see testCase8.
Definition: MePolyPts.cpp:750
size_t IdxFromPt3d(const Pt3d &a_pt)
Returns the index of a location by hashing that location with the current list of points...
Definition: MePolyPts.cpp:848
std::vector< size_t > HashPts()
Hashes the point locations.
Definition: MePolyPts.cpp:579
bool PolyInsideOfPoly(const std::vector< size_t > &a_poly, const std::vector< size_t > &a_polyToTest)
Returns true if a_polyToTest is inside of a_poly.
Definition: MePolyPts.cpp:809
void CalcLoopsForCleanPolyOffset(std::list< size_t > &a_sequence, std::list< std::vector< size_t >> &a_loops)
Calculates new loops from a sequence that has intersections included.
Definition: MePolyPts.cpp:676
std::list< size_t > SequenceWithIntersects(std::vector< size_t > &a_segs)
Returns a new sequence that includes intersection indexes.
Definition: MePolyPts.cpp:629
Implementation of MePolyPts.
Definition: MePolyPts.cpp:57
void IntersectSegs(const std::vector< size_t > &a_segs)
Intersects the segments.
Definition: MePolyPts.cpp:607
std::set< size_t > SetIdx
typedef for shorter declaration
Definition: MePolyPts.h:22
BSHP< impl > m_p
implementation class
Definition: MePolyPts.h:57
void CheckIntersectTwoSegs(size_t a_i, size_t a_j, const std::vector< size_t > &a_iSeg, const std::vector< size_t > &a_jSeg)
Intersects 2 segments.
Definition: MePolyPts.cpp:661
BSHP< std::vector< Pt3d > > PtsSharedPointer()
Returns the vector of points.
Definition: MePolyPts.cpp:571
MePolyPts()
constructor
Definition: MePolyPts.cpp:547
std::vector< Pt3d > & Pts()
Returns the vector of points.
Definition: MePolyPts.cpp:563
std::vector< size_t > SegmentsForCleanPolyOffset()
Returns the segments that will be used in CleanPolyOffset.
Definition: MePolyPts.cpp:589
void RemoveBackwardLoopsForCleanPolyOffset(std::list< std::vector< size_t >> &a_loops, int a_pType)
Removes loops that are "backwards" for CleanPolyOffset. "backwards" depends on the type of input (OUT...
Definition: MePolyPts.cpp:722
double & XyTol()
Returns the tolerance.
Definition: MePolyPts.cpp:555
Utility class to work with polygon paving.
Definition: MePolyPts.h:28