Fade2D Documentation pages v2.15
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 #ifndef FADE2D_EXPORT
23  #include "License.h"
24 #endif
25 #include "Segment2.h"
26 #include "MsgBase.h"
27 #include "Bbox2.h"
28 
29 
31 
36 {
42 };
43 
45 {
52 };
53 
54 #if GEOM_PSEUDO3D==GEOM_TRUE
55  namespace GEOM_FADE25D {
56 #elif GEOM_PSEUDO3D==GEOM_FALSE
57  namespace GEOM_FADE2D {
58 #else
59  #error GEOM_PSEUDO3D is not defined
60 #endif
61 
62 class SegmentCheckerData; // FWD, pImpl to ease DLL export
63 
64 
79 class CLASS_DECLSPEC SegmentChecker
80 {
81 public:
82  // *** CTOR and DTOR ***
83 
92  explicit SegmentChecker(const std::vector<Segment2*>& vSegments_);
94  ~SegmentChecker();
95 
115 
116 
122  void setLimit(const Bbox2& bbx);
123 
128  Bbox2 getLimit() const;
129 
136  Segment2* getSegment(size_t i) const;
139  size_t getNumberOfSegments() const;
144  int getIndex(Segment2* pSeg) const;
160  void subscribe(MsgType msgType,MsgBase* pMsg);
167  void unsubscribe(MsgType msgType,MsgBase* pMsg);
168 
169  // *** Visualization and debug ***
177  void showSegments(const char* name) const;
178 
179 
188  void showIllegalSegments(bool bAlsoEndPointIntersections,const char* name) const;
189 
190  // *** Intersectors ***
207  void getIllegalSegments(bool bAlsoEndPointIntersections,std::vector<Segment2*>& vIllegalSegmentsOut) const;
208 
220 
221 
237  void getIntersectors( Segment2* pTestSegment,
238  bool bAlsoEndPointIntersections,
239  std::vector<std::pair<Segment2*,SegmentIntersectionType> >& vIntersectorsOut) const;
240 
241  // Intersections
242 #if GEOM_PSEUDO3D==GEOM_TRUE
261  void getIntersectionPoint( SegmentIntersectionType sit,
262  const Segment2& seg0,
263  const Segment2& seg1,
264  Point2& ispOut0,
265  Point2& ispOut1
266  ) const;
286  void getIntersectionSegment(const Segment2& seg0,
287  const Segment2& seg1,
288  Segment2& issOut0,
289  Segment2& issOut1
290  ) const;
291 #else
306  const Segment2& seg0,
307  const Segment2& seg1,
308  Point2& ispOut
309  ) const;
321  const Segment2& seg1,
322  Segment2& issOut
323  ) const;
324 #endif
325 
332 
333 
334 
335 private:
337  SegmentChecker& operator=(const SegmentChecker&);
341  SegmentIntersectionType getIntersectionType_degeneratePart(
342  const Segment2*& pSeg1,
343  const Segment2*& pSeg2,
344  Point2& p1,
345  Point2& p2,
346  Point2& p3,
347  Point2& p4
348  ) const;
349  void addSegments(const std::vector<Segment2*>& vSegments_);
350 
351  // Data
352  SegmentCheckerData* pSCD;
353 
354 
359 };
360 
361 } // Namespace
362 
SegmentIntersectionType
Definition: SegmentChecker.h:36
@ SIT_ENDPOINT
Definition: SegmentChecker.h:41
@ SIT_UNINITIALIZED
Definition: SegmentChecker.h:37
@ SIT_NONE
Definition: SegmentChecker.h:38
@ SIT_SEGMENT
Definition: SegmentChecker.h:39
@ SIT_POINT
Definition: SegmentChecker.h:40
ClipResult
Definition: SegmentChecker.h:45
@ CR_EMPTY
Definition: SegmentChecker.h:47
@ CR_CLIPPED_NONDEGENERATE
Definition: SegmentChecker.h:49
@ CR_INVALID
Definition: SegmentChecker.h:46
@ CR_COMPLETE_NONDEGENERATE
Definition: SegmentChecker.h:51
@ CR_COMPLETE_DEGENERATE
Definition: SegmentChecker.h:50
@ CR_CLIPPED_DEGENERATE
Definition: SegmentChecker.h:48
Bbox2 is an axis aligned 2D bounding box.
Definition: Bbox2.h:37
MsgBase, a base class for message subscriber classes.
Definition: MsgBase.h:47
Point.
Definition: Point2.h:53
Segment.
Definition: Segment2.h:39
SegmentChecker identifies intersecting line segments.
Definition: SegmentChecker.h:80
void showSegments(const char *name) const
void setLimit(const Bbox2 &bbx)
size_t getNumberOfSegments() const
void getIntersectors(Segment2 *pTestSegment, bool bAlsoEndPointIntersections, std::vector< std::pair< Segment2 *, SegmentIntersectionType > > &vIntersectorsOut) const
void getIntersectionPoint(SegmentIntersectionType typ, const Segment2 &seg0, const Segment2 &seg1, Point2 &ispOut) const
static const char * getIntersectionTypeString(SegmentIntersectionType sit)
void unsubscribe(MsgType msgType, MsgBase *pMsg)
void getIntersectionSegment(const Segment2 &seg0, const Segment2 &seg1, Segment2 &issOut) const
void subscribe(MsgType msgType, MsgBase *pMsg)
int getIndex(Segment2 *pSeg) const
SegmentIntersectionType getIntersectionType(const Segment2 *pSeg1, const Segment2 *pSeg2) const
Segment2 * getSegment(size_t i) const
SegmentChecker(const std::vector< Segment2 * > &vSegments_)
void showIllegalSegments(bool bAlsoEndPointIntersections, const char *name) const
ClipResult clipSegment(Segment2 &seg)
void getIllegalSegments(bool bAlsoEndPointIntersections, std::vector< Segment2 * > &vIllegalSegmentsOut) const