6471f4047b742bc0856c7e0b8850d3759f691d9a
Stefan Schuermans implement converting paths...

Stefan Schuermans authored 11 years ago

1) /* drawing (DXF) to G-code (NGC) converter
2)  * Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
Stefan Schuermans license CC-BY-SA --> GPL (m...

Stefan Schuermans authored 11 years ago

3)  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
Stefan Schuermans implement converting paths...

Stefan Schuermans authored 11 years ago

4)  */
5) 
6) #ifndef POLYGONS_H
7) #define POLYGONS_H
8) 
9) #include <boost/shared_ptr.hpp>
10) #include <vector>
11) 
Stefan newer CGAL really needs exe...

Stefan authored 11 years ago

12) #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
Stefan revert to inexact construct...

Stefan authored 11 years ago

13) #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
Stefan Schuermans implement converting paths...

Stefan Schuermans authored 11 years ago

14) #include <CGAL/Polygon_2.h>
15) #include <CGAL/Polygon_with_holes_2.h>
Stefan Schuermans implement filling polygon w...

Stefan Schuermans authored 11 years ago

16) #include <CGAL/create_straight_skeleton_from_polygon_with_holes_2.h>
Stefan Schuermans implement converting paths...

Stefan Schuermans authored 11 years ago

17) 
18) #include "layer.h"
19) 
20) /// a set of polygons
21) class Polygons {
22) public:
Stefan revert to inexact construct...

Stefan authored 11 years ago

23)   typedef CGAL::Exact_predicates_exact_constructions_kernel   CgExKern;
24) 
25)   typedef CgExKern::Point_2                    CgExPoint;
26)   typedef CGAL::Polygon_2<CgExKern>            CgExPoly;
27)   typedef std::vector<CgExPoly>                CgExPolyVec;
28)   typedef CGAL::Polygon_with_holes_2<CgExKern> CgExPolyHoles;
29)   typedef std::vector<CgExPolyHoles>           CgExPolyHolesVec;
30) 
31)   typedef CGAL::Exact_predicates_inexact_constructions_kernel CgKern;
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

32) 
33)   typedef CgKern::Point_2                    CgPoint;
34)   typedef CGAL::Polygon_2<CgKern>            CgPoly;
35)   typedef CGAL::Polygon_with_holes_2<CgKern> CgPolyHoles;
36)   typedef std::vector<CgPoly>                CgPolyVec;
37)   typedef std::vector<CgPolyHoles>           CgPolyHolesVec;
38)   typedef boost::shared_ptr<CgPoly>          CgPolyPtr;
39)   typedef boost::shared_ptr<CgPolyHoles>     CgPolyHolesPtr;
Stefan revert to inexact construct...

Stefan authored 11 years ago

40)   typedef CGAL::Straight_skeleton_2<CgKern>  CgSs;
Stefan Schuermans implement filling polygon w...

Stefan Schuermans authored 11 years ago

41)   typedef boost::shared_ptr<CgSs>            CgSsPtr;
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

42)   typedef std::vector<CgPolyPtr>             CgPolyPtrVec;
43)   typedef std::vector<CgPolyHolesPtr>        CgPolyHolesPtrVec;
Stefan Schuermans implement converting paths...

Stefan Schuermans authored 11 years ago

44) 
45)   /**
46)    * @brief clear all polygons
47)    */
48)   void clear();
49) 
50)   /**
51)    * @brief add polygons from layer
52)    * @param[in] layer layer to obtain the polygons from
53)    * @param[in] eqDist maximum distance of two points to be considered equal
54)    * @return if the layer could be converted to polygons and imported
55)    */
56)   bool addLayer(const Layer &layer, double eqDist);
57) 
58)   /**
59)    * @brief load polygons from layer
60)    * @param[in] layer layer to obtain the polygons from
61)    * @param[in] eqDist maximum distance of two points to be considered equal
62)    * @return if the layer could be converted to polygons and imported
63)    */
64)   bool loadLayer(const Layer &layer, double eqDist);
65) 
Stefan Schuermans implement inside cutting (h...

Stefan Schuermans authored 11 years ago

66)   /**
67)    * @brief create inner offset polygons
68)    * @param[in] offset offset, > 0.0
69)    * @param[out] offsetPolys offset polygons (!= *this)
Stefan Schuermans implement outer polygon off...

Stefan Schuermans authored 11 years ago

70)    * @return if inner offset polygons could be constructed
Stefan Schuermans implement inside cutting (h...

Stefan Schuermans authored 11 years ago

71)    */
Stefan Schuermans implement outer polygon off...

Stefan Schuermans authored 11 years ago

72)   bool createInnerOffset(double offset, Polygons &offsetPolys) const;
73) 
74)   /**
75)    * @brief create outer offset polygons
76)    * @param[in] offset offset, > 0.0
77)    * @param[out] offsetPolys offset polygons (!= *this)
78)    * @return if outer offset polygons could be constructed
79)    */
80)   bool createOuterOffset(double offset, Polygons &offsetPolys) const;
Stefan Schuermans implement inside cutting (h...

Stefan Schuermans authored 11 years ago

81) 
Stefan Schuermans implement filling polygon w...

Stefan Schuermans authored 11 years ago

82)   /**
83)    * @brief fill insides of polygons by creating inner offset polygons
84)    * @param[in] offset offset, > 0.0
85)    * @param[out] offsetPolys offset polygons (!= *this)
86)    * @return if insides of polygons could be filles with inner offset polygons
87)    */
88)   bool fillInnerOffset(double offset, Polygons &offsetPolys) const;
89) 
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

90)   /**
91)    * @brief add all polygons with holes as multiple paths to a layer
92)    * @param[in,out] layer layer to add paths to
93)    */
94)   void addToLayer(Layer &layer) const;
95) 
96)   /**
97)    * @brief write all polygons with holes as multiple paths to a layer
98)    * @param[in,out] layer layer to write paths to
99)    */
100)   void writeToLayer(Layer &layer) const;
101) 
102) protected:
Stefan Schuermans implement outer polygon off...

Stefan Schuermans authored 11 years ago

103)   /**
104)    * @brief create outer offset polygon
105)    * @param[in] poly polygon to create outer offset of
106)    * @param[in] offset offset, > 0.0
107)    * @param[out] offsetPoly offset polygon (!= *this)
108)    * @return if outer offset polygon could be constructed
109)    */
110)   static bool createOuterOffsetPoly(const CgPolyHoles &poly, double offset,
111)                                     CgPolyHoles &offsetPoly);
112) 
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

113)   /**
114)    * @brief add a polygon as path to a layer
115)    * @param[in] poly polygon to add to layer
116)    * @param[in,out] layer layer to add path to
117)    */
118)   static void PolyToLayer(const CgPoly &poly, Layer &layer);
119) 
120)   /**
121)    * @brief add a polygon with holes as multiple paths to a layer
122)    * @param[in] poly polygon with holes to add to layer
123)    * @param[in,out] layer layer to add paths to
124)    */
125)   static void PolyHolesToLayer(const CgPolyHoles &poly, Layer &layer);
126) 
127) public: