| 
    xmsmesh
    1.0
    
   | 
 
#include <xmsmesh/meshing/detail/MePolyPts.h>#include <boost/geometry/geometry.hpp>#include <xmscore/math/math.h>#include <xmsinterp/geometry/GmBoostTypes.h>#include <xmsinterp/geometry/geoms.h>#include <xmsinterp/geometry/GmPtSearch.h>#include <xmsmesh/meshing/detail/MePolyOffsetter.h>#include <xmscore/misc/boost_defines.h>#include <xmscore/misc/XmError.h>Go to the source code of this file.
Classes | |
| class | xms::MePolyPts::impl | 
| Implementation of MePolyPts.  More... | |
Macros | |
| #define | T_TOL 1e-13 | 
| tolerance used in multipoly intersector  | |
Typedefs | |
| typedef std::map< size_t, std::multimap< double, size_t > > | xms::SegMap | 
| map for segment intersection indices  | |
| typedef std::map< const std::vector< size_t > *, SegMap > | xms::MapSegMap | 
| map used to see where segments cross each other  | |
Functions | |
| static size_t | xms::iNextSegIdx (size_t a_i, const std::vector< size_t > &a_seg) | 
| Get the next index for a segment. The segments are stored as a vector and it forms a closed loop so the last item in the vector makes a segment with the first item in the vector.  More... | |
| static void | xms::iAddIntersection (size_t a_i, const std::vector< size_t > &a_iSeg, size_t a_j, double a_t, MapSegMap &a_mapSegCross) | 
| Adds an intersection to a map of intersection information.  More... | |
| static void | xms::iHashPts (std::vector< size_t > &a_newIdx, BSHP< std::vector< Pt3d >> a_pts, double a_xyTol) | 
| hash the points and fill in a vector with the new index assigned to each point. If there are no duplicates the a_newIdx will be 0,1,2,3,4 If there are duplicates then a_newIdx will be 0,1,0,1,4,5,0...  More... | |
| static std::vector< GmBstBox3d > | xms::iCalcSegEnvelopes (const std::vector< size_t > &a_segs, const std::vector< Pt3d > &a_pts) | 
| Returns the envelopes of the segments.  More... | |
| static bool | xms::iEnvelopesOverlapOrTouch (size_t a_i, size_t a_j, const std::vector< GmBstBox3d > &a_iEnv, const std::vector< GmBstBox3d > &a_jEnv) | 
| Returns true if the envelopes overlap or touch.  More... | |
| static double | xms::iCalcIntersectionT (const Pt3d &a_p0, const Pt3d &a_p1, Pt3d &a_iPt, double a_xyTol) | 
| Computes the T value for the point on the line a_p0, a_p1.  More... | |
| static bool | xms::iCheckSharedPtIdx (size_t a_i, size_t a_j, const std::vector< size_t > &a_iSeg, const std::vector< size_t > &a_jSeg, const std::vector< Pt3d > &a_pts, double a_xyTol, MapSegMap &a_mapSegCross) | 
| Check segments to see if they share a point index.  More... | |
| static bool | xms::iIntersectTwoSegments (const Pt3d &a_s1p0, const Pt3d &a_s1p1, const Pt3d &a_s2p0, const Pt3d &a_s2p1, double a_xyTol, std::vector< Pt3d > &a_pts) | 
| Intersects 2 segments. Normally there is only 1 intersection between 2 segments but if the lines are colinear and they overlap then we get the endpoint of the overlap as the intersection points.  More... | |
| static void | xms::iCheckIntersection (size_t a_i, size_t a_j, const std::vector< size_t > &a_iSeg, const std::vector< size_t > &a_jSeg, BSHP< std::vector< Pt3d >> &a_shptrPts, double a_xyTol, MapSegMap &a_mapSegCross, BSHP< GmPtSearch > a_ps) | 
| Sees if 2 segments intersects and if they do then information is added to the a_mapSegCross.  More... | |
| static bool | xms::iPolyInsideOfPoly (const GmBstPoly3d &a_poly, const std::vector< size_t > &a_polyToTest, const std::vector< Pt3d > &a_pts) | 
| Returns true if a polygon is inside of another polygon.  More... | |
| static void | xms::iFindPolysInsideOfOtherPolys (std::vector< std::vector< size_t >> &a_polyInsideOfPoly, std::list< std::vector< size_t >> &a_loops, MePolyPts &a_polyPts) | 
| Given a list of polygons, finds the polygons that are inside of other polygons.  More... | |
| static std::vector< double > | xms::iCalcPolyAreas (const std::list< std::vector< size_t >> &a_loops, const std::vector< Pt3d > &a_pts) | 
| Calculates polygon areas.  More... | |
| static void | xms::iRemoveRepeatedSegmentFromSequence (std::list< size_t > &a_sequence) | 
| Removes a repeated segment (2 numbers) from a sequence.  More... | |
Definition in file MePolyPts.cpp.
      
  | 
  static | 
Adds an intersection to a map of intersection information.
| a_i | Index for a segment. | 
| a_iSeg | Vector of segments that a_i refers to. | 
| a_j | Index for a point location. | 
| a_t | Parametric value for the location of point a_j along segment a_i. | 
| a_mapSegCross | Map that holds information about intersections of line segments. | 
Definition at line 101 of file MePolyPts.cpp.
References xms::iAddIntersection().
Referenced by xms::iAddIntersection(), xms::iCheckIntersection(), and xms::iCheckSharedPtIdx().
      
  | 
  static | 
Computes the T value for the point on the line a_p0, a_p1.
| a_p0 | Location of the 1st point defining a line segment. | 
| a_p1 | Location of the 2nd point defining a line segment. | 
| a_iPt | Location of the intersection that lies on the line segment defined by a_p0, a_p1. | 
| a_xyTol | Tolerance used in geometric calculations. | 
Definition at line 211 of file MePolyPts.cpp.
References EQ_TOL(), gmEqualPointsXY(), xms::iCalcIntersectionT(), T_TOL, xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by xms::iCalcIntersectionT(), xms::iCheckIntersection(), and xms::iCheckSharedPtIdx().
      
  | 
  static | 
Calculates polygon areas.
| a_loops | 2D vector of point indexes that define polygons. | 
| a_pts | Locations referred to by indexes in a_loops. | 
Definition at line 492 of file MePolyPts.cpp.
References gmPolygonArea(), and xms::iCalcPolyAreas().
Referenced by xms::MePolyPts::ClassifyLoopsFromInPolyAndRemoveInvalid(), xms::iCalcPolyAreas(), and xms::MePolyPts::RemoveBackwardLoopsForCleanPolyOffset().
      
  | 
  static | 
Returns the envelopes of the segments.
| a_segs | Vector of indexes defining the segments. This is a closed loop polyline the first point connects to the last point in the vector. | 
| a_pts | Vector of locations referenced by the indexes in a_segs. | 
Definition at line 154 of file MePolyPts.cpp.
References xms::iCalcSegEnvelopes(), xms::iNextSegIdx(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by xms::iCalcSegEnvelopes(), and xms::MePolyPts::IntersectSegs().
      
  | 
  static | 
Sees if 2 segments intersects and if they do then information is added to the a_mapSegCross.
| a_i | Index to a segment. | 
| a_j | Index to a segment. | 
| a_iSeg | Vector of segments referred to by a_i. | 
| a_jSeg | Vector of segments referred to by a_j. | 
| a_shptrPts | Vector of point locations. The segments just store indexes that refer to locations in this vector. | 
| a_xyTol | Tolerance used in geometric calculations. | 
| a_mapSegCross | Map of intersection information. | 
| a_ps | A PtSearch class. Will hash newly calculated locations with existing point locations. | 
segment are sorted correctly
Definition at line 348 of file MePolyPts.cpp.
References xms::iAddIntersection(), xms::iCalcIntersectionT(), xms::iCheckIntersection(), xms::iCheckSharedPtIdx(), xms::iIntersectTwoSegments(), xms::iNextSegIdx(), and XM_ASSERT.
Referenced by xms::MePolyPts::CheckIntersectTwoSegs(), and xms::iCheckIntersection().
      
  | 
  static | 
Check segments to see if they share a point index.
| a_i | Index to a segment. | 
| a_j | Index to a segment. | 
| a_iSeg | Vector of segments referred to by a_i. | 
| a_jSeg | Vector of segments referred to by a_j. | 
| a_pts | Vector of point locations. The segments just store indexes that refer to locations in this vector. | 
| a_xyTol | Tolerance used in geometric calculations. | 
| a_mapSegCross | Map of intersection information. | 
Definition at line 248 of file MePolyPts.cpp.
References gmOnLineAndBetweenEndpointsWithTol(), xms::iAddIntersection(), xms::iCalcIntersectionT(), xms::iCheckSharedPtIdx(), xms::iNextSegIdx(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by xms::iCheckIntersection(), and xms::iCheckSharedPtIdx().
      
  | 
  static | 
Returns true if the envelopes overlap or touch.
| a_i | Index of an envelope of a segment. | 
| a_j | Index of an envelope of a segment. | 
| a_iEnv | Vector of envelopes referenced by a_i. | 
| a_jEnv | Vector of envelopes referenced by a_j. | 
Definition at line 191 of file MePolyPts.cpp.
References xms::iEnvelopesOverlapOrTouch(), xms::Pt3< T >::x, and xms::Pt3< T >::y.
Referenced by xms::iEnvelopesOverlapOrTouch(), and xms::MePolyPts::IntersectSegs().
      
  | 
  static | 
Given a list of polygons, finds the polygons that are inside of other polygons.
| a_polyInsideOfPoly | 2D vector of polygon indexes. | 
| a_loops | 2D vector of point indexes that define polygons. | 
| a_polyPts | Class with information on locations of points that define the polygons. | 
Definition at line 453 of file MePolyPts.cpp.
References xms::iFindPolysInsideOfOtherPolys(), xms::iPolyInsideOfPoly(), and xms::MePolyPts::Pts().
Referenced by xms::MePolyPts::ClassifyLoopsFromInPolyAndRemoveInvalid(), and xms::iFindPolysInsideOfOtherPolys().
      
  | 
  static | 
hash the points and fill in a vector with the new index assigned to each point. If there are no duplicates the a_newIdx will be 0,1,2,3,4 If there are duplicates then a_newIdx will be 0,1,0,1,4,5,0...
| a_newIdx | Vector of new indexes for points. | 
| a_pts | Vector of point locations. | 
| a_xyTol | Tolerance used to determine if 2 locations should be considered the same location. | 
Definition at line 121 of file MePolyPts.cpp.
References xms::iHashPts(), and xms::GmPtSearch::New().
Referenced by xms::MePolyPts::HashPts(), and xms::iHashPts().
      
  | 
  static | 
Intersects 2 segments. Normally there is only 1 intersection between 2 segments but if the lines are colinear and they overlap then we get the endpoint of the overlap as the intersection points.
| a_s1p0 | Location of 1st point on segment 1. | 
| a_s1p1 | Location of 2nd point on segment 1. | 
| a_s2p0 | Location of 1st point on segment 2. | 
| a_s2p1 | Location of 2nd point on segment 2. | 
| a_xyTol | Tolerance used in geometric calculations. | 
| a_pts | Locations of intersections between 2 segments. | 
Definition at line 291 of file MePolyPts.cpp.
References EQ_TOL(), gmIntersectLineSegmentsWithTol(), gmOnLineAndBetweenEndpointsWithTol(), xms::iIntersectTwoSegments(), T_TOL, xms::Pt3< T >::x, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by xms::iCheckIntersection(), and xms::iIntersectTwoSegments().
      
  | 
  static | 
Get the next index for a segment. The segments are stored as a vector and it forms a closed loop so the last item in the vector makes a segment with the first item in the vector.
| a_i | Index into the vector a_seg. | 
| a_seg | Vector of indexes that make up a closed loop polyline. | 
Definition at line 85 of file MePolyPts.cpp.
References xms::iNextSegIdx().
Referenced by xms::iCalcSegEnvelopes(), xms::iCheckIntersection(), xms::iCheckSharedPtIdx(), and xms::iNextSegIdx().
      
  | 
  static | 
Returns true if a polygon is inside of another polygon.
| a_poly | A polygon used to test a_polyToTest | 
| a_polyToTest | Vector of indices defining a polygon. Want to determine if it is inside of a_poly. | 
| a_pts | Vector of locations referenced by a_polyToTest. | 
Definition at line 430 of file MePolyPts.cpp.
References xms::iPolyInsideOfPoly().
Referenced by xms::iFindPolysInsideOfOtherPolys(), xms::iPolyInsideOfPoly(), and xms::MePolyPts::PolyInsideOfPoly().
      
  | 
  static | 
Removes a repeated segment (2 numbers) from a sequence.
| a_sequence | List of indexes defining a closed loop polyline. | 
Definition at line 511 of file MePolyPts.cpp.
References xms::iRemoveRepeatedSegmentFromSequence().
Referenced by xms::MePolyPts::CalcLoopsForCleanPolyOffset(), and xms::iRemoveRepeatedSegmentFromSequence().