Fade2D Documentation pages v1.86
Delaunay Features
SegmentChecker.h
Go to the documentation of this file.
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the Fade2D library. The student license is free
4 // of charge and covers personal non-commercial research. Licensees
5 // holding a commercial license may use this file in accordance with
6 // the Commercial License Agreement.
7 //
8 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
9 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
10 // FOR A PARTICULAR PURPOSE.
11 //
12 // Please contact the author if any conditions of this licensing are
13 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
17 
18 
19 #pragma once
20 #include <map>
21 #include "common.h"
22 #include "Segment2.h"
23 #include "MsgBase.h"
25 
30 {
36 };
37 
38 #if GEOM_PSEUDO3D==GEOM_TRUE
39  namespace GEOM_FADE25D {
40 #elif GEOM_PSEUDO3D==GEOM_FALSE
41  namespace GEOM_FADE2D {
42 #else
43  #error GEOM_PSEUDO3D is not defined
44 #endif
45 
46 class SegmentCheckerData; // FWD, pImpl to ease DLL export
47 
48 
63 class CLASS_DECLSPEC SegmentChecker
64 {
65 public:
66  // *** CTOR and DTOR ***
67 
76  explicit SegmentChecker(const std::vector<Segment2*>& vSegments_);
78  ~SegmentChecker();
79 
86  Segment2* getSegment(size_t i) const;
89  size_t getNumberOfSegments() const;
94  int getIndex(Segment2* pSeg) const;
110  void subscribe(MsgType msgType,MsgBase* pMsg);
117  void unsubscribe(MsgType msgType,MsgBase* pMsg);
118 
119  // *** Visualization and debug ***
127  void showSegments(const char* name) const;
128 
129 
138  void showIllegalSegments(bool bAlsoEndPointIntersections,const char* name) const;
139 
140  // *** Intersectors ***
157  void getIllegalSegments(bool bAlsoEndPointIntersections,std::vector<Segment2*>& vIllegalSegmentsOut) const;
158 
169  SegmentIntersectionType getIntersectionType(const Segment2* pSeg1,const Segment2* pSeg2) const;
170 
171 
187  void getIntersectors( Segment2* pTestSegment,
188  bool bAlsoEndPointIntersections,
189  std::vector<std::pair<Segment2*,SegmentIntersectionType> >& vIntersectorsOut) const;
190 
191  // Intersections
192 #if GEOM_PSEUDO3D==GEOM_TRUE
193 
211  void getIntersectionPoint( SegmentIntersectionType sit,
212  const Segment2& seg0,
213  const Segment2& seg1,
214  Point2& ispOut0,
215  Point2& ispOut1
216  ) const;
236  void getIntersectionSegment(const Segment2& seg0,
237  const Segment2& seg1,
238  Segment2& issOut0,
239  Segment2& issOut1
240  ) const;
241 #else
242 
255  void getIntersectionPoint( SegmentIntersectionType typ,
256  const Segment2& seg0,
257  const Segment2& seg1,
258  Point2& ispOut
259  ) const;
270  void getIntersectionSegment(const Segment2& seg0,
271  const Segment2& seg1,
272  Segment2& issOut
273  ) const;
274 #endif
275 
282  const char* getIntersectionTypeString(SegmentIntersectionType sit) const;
283 
284 
285 private:
290  SegmentIntersectionType getIntersectionType_degeneratePart(
291  const Segment2*& pSeg1,
292  const Segment2*& pSeg2,
293  Point2& p1,
294  Point2& p2,
295  Point2& p3,
296  Point2& p4
297  ) const;
298  void addSegments(const std::vector<Segment2*>& vSegments_);
299 
300  // Data
301  SegmentCheckerData* pSCD;
302 
303 
308 };
309 
310 } // Namespace
311 
SIT_SEGMENT
@ SIT_SEGMENT
Definition: SegmentChecker.h:33
GEOM_FADE2D::Point2
Point.
Definition: Point2.h:40
SIT_UNINITIALIZED
@ SIT_UNINITIALIZED
Definition: SegmentChecker.h:31
GEOM_FADE2D::MsgBase
MsgBase, a base class for message subscriber classes.
Definition: MsgBase.h:45
SegmentIntersectionType
SegmentIntersectionType
Definition: SegmentChecker.h:29
SIT_POINT
@ SIT_POINT
Definition: SegmentChecker.h:34
SIT_NONE
@ SIT_NONE
Definition: SegmentChecker.h:32
GEOM_FADE2D::SegmentChecker
SegmentChecker identifies intersecting line segments.
Definition: SegmentChecker.h:63
SIT_ENDPOINT
@ SIT_ENDPOINT
Definition: SegmentChecker.h:35
GEOM_FADE2D::Segment2
Segment.
Definition: Segment2.h:38