Fade2D Documentation pages v2.16.8
Delaunay Features
PolygonClipper.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 // unclear to you.
14 //
15 // Support: https://www.geom.at/contact/
16 // Project: https://www.geom.at/fade2d/html/
17 
18 
19 #pragma once
20 #include <vector>
21 #include "Segment2.h"
22 #include "PolygonTree.h"
23 #include "Visualizer2.h"
24 #include "common.h"
25 
27 
28 #if GEOM_PSEUDO3D==GEOM_TRUE
29  namespace GEOM_FADE25D {
30 #elif GEOM_PSEUDO3D==GEOM_FALSE
31  namespace GEOM_FADE2D {
32 #else
33  #error GEOM_PSEUDO3D is not defined
34 #endif
35 class PolygonClipperImpl; // FWD
36 class Zone2; // FWD
37 
60 bool CLASS_DECLSPEC clipPolygon(Zone2* pBaseZoneIn,std::vector<Segment2>& vPolygonInput,bool bWithDrape,std::vector<Segment2>& vPolygonSegmentsOut);
61 
76 class CLASS_DECLSPEC PolygonClipper
77 {
78 public:
79 
91  PolygonClipper(const std::vector<Segment2>& vSegments, double collapseDist);
94 
104  void show(Visualizer2* pVis,const Color& matColor=Color(CYELLOW,0,true),const Color airColor=Color(CWHITE,0,false)) const;
115  void show(const std::string& name,const Color& matColor=Color(CYELLOW,0,true),const Color airColor=Color(CWHITE,0,false)) const;
116 
117 
159  void getOuterSegments_CCW(std::vector<Segment2>& vOuterSegments_CCW) const;
160 
161 
194  void getSegments_regionOriented(std::vector<Segment2>& vSegments_regionOriented) const;
195 
196 private:
200  PolygonClipper &operator=(const PolygonClipper &);
201 
202 
203  // Data
204  PolygonClipperImpl* pImpl;
205 };
206 
207 
208 
209 
210 
211 } // Namespace
212 
bool CLASS_DECLSPEC clipPolygon(Zone2 *pBaseZoneIn, std::vector< Segment2 > &vPolygonInput, bool bWithDrape, std::vector< Segment2 > &vPolygonSegmentsOut)
Limits an input polygon to a specified zone.
Color for visualization.
Definition: Color.h:65
The PolygonClipper class handles polygon repair operations.
Definition: PolygonClipper.h:77
PolygonTree * getPolygonTree()
Returnes the PolygonTree structure.
void getOuterSegments_CCW(std::vector< Segment2 > &vOuterSegments_CCW) const
Retrieves the outermost segments of the polygon in counter-clockwise direction.
void show(Visualizer2 *pVis, const Color &matColor=Color(CYELLOW, 0, true), const Color airColor=Color(CWHITE, 0, false)) const
Visualizes the polygon regions as a .PDF or PostScript file.
void show(const std::string &name, const Color &matColor=Color(CYELLOW, 0, true), const Color airColor=Color(CWHITE, 0, false)) const
Visualizes the polygon regions as a .PDF or PostScript file.
~PolygonClipper()
Destructor for the PolygonClipper class.
PolygonClipper(const std::vector< Segment2 > &vSegments, double collapseDist)
Constructs a PolygonClipper object.
void getSegments_regionOriented(std::vector< Segment2 > &vSegments_regionOriented) const
Retrieves the inner and outer polygon segments oriented by region.
Represents the possibly nested layers of a polygon as a hierarchical structure.
Definition: PolygonTree.h:53
A PDF and Postscript Writer for 2D Visualization.
Definition: Visualizer2.h:60
Represents a defined area within a triangulation.
Definition: Zone2.h:99