b49e0734a3389a739166471f6e0d8b71f8ff03c2
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 Schuermans implement converting paths...

Stefan Schuermans authored 11 years ago

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

Stefan Schuermans authored 11 years ago

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

Stefan Schuermans authored 11 years ago

16) 
17) #include "layer.h"
18) 
19) /// a set of polygons
20) class Polygons {
21) public:
Stefan newer CGAL really needs exe...

Stefan authored 11 years ago

22)   typedef CGAL::Exact_predicates_exact_constructions_kernel CgKern;
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

23) 
24)   typedef CgKern::Point_2                    CgPoint;
25)   typedef CGAL::Polygon_2<CgKern>            CgPoly;
26)   typedef CGAL::Polygon_with_holes_2<CgKern> CgPolyHoles;
Stefan Schuermans implement filling polygon w...

Stefan Schuermans authored 11 years ago

27)   typedef CGAL::Straight_skeleton_2<CgKern>  CgSs;
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

28)   typedef std::vector<CgPoly>                CgPolyVec;
29)   typedef std::vector<CgPolyHoles>           CgPolyHolesVec;
30)   typedef boost::shared_ptr<CgPoly>          CgPolyPtr;
31)   typedef boost::shared_ptr<CgPolyHoles>     CgPolyHolesPtr;
Stefan Schuermans implement filling polygon w...

Stefan Schuermans authored 11 years ago

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

Stefan Schuermans authored 11 years ago

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

Stefan Schuermans authored 11 years ago

35) 
36)   /**
37)    * @brief clear all polygons
38)    */
39)   void clear();
40) 
41)   /**
42)    * @brief add polygons from layer
43)    * @param[in] layer layer to obtain the polygons from
44)    * @param[in] eqDist maximum distance of two points to be considered equal
45)    * @return if the layer could be converted to polygons and imported
46)    */
47)   bool addLayer(const Layer &layer, double eqDist);
48) 
49)   /**
50)    * @brief load polygons from layer
51)    * @param[in] layer layer to obtain the polygons from
52)    * @param[in] eqDist maximum distance of two points to be considered equal
53)    * @return if the layer could be converted to polygons and imported
54)    */
55)   bool loadLayer(const Layer &layer, double eqDist);
56) 
Stefan Schuermans implement inside cutting (h...

Stefan Schuermans authored 11 years ago

57)   /**
58)    * @brief create inner offset polygons
59)    * @param[in] offset offset, > 0.0
60)    * @param[out] offsetPolys offset polygons (!= *this)
Stefan Schuermans implement outer polygon off...

Stefan Schuermans authored 11 years ago

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

Stefan Schuermans authored 11 years ago

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

Stefan Schuermans authored 11 years ago

63)   bool createInnerOffset(double offset, Polygons &offsetPolys) const;
64) 
65)   /**
66)    * @brief create outer offset polygons
67)    * @param[in] offset offset, > 0.0
68)    * @param[out] offsetPolys offset polygons (!= *this)
69)    * @return if outer offset polygons could be constructed
70)    */
71)   bool createOuterOffset(double offset, Polygons &offsetPolys) const;
Stefan Schuermans implement inside cutting (h...

Stefan Schuermans authored 11 years ago

72) 
Stefan Schuermans implement filling polygon w...

Stefan Schuermans authored 11 years ago

73)   /**
74)    * @brief fill insides of polygons by creating inner offset polygons
75)    * @param[in] offset offset, > 0.0
76)    * @param[out] offsetPolys offset polygons (!= *this)
77)    * @return if insides of polygons could be filles with inner offset polygons
78)    */
79)   bool fillInnerOffset(double offset, Polygons &offsetPolys) const;
80) 
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

81)   /**
82)    * @brief add all polygons with holes as multiple paths to a layer
83)    * @param[in,out] layer layer to add paths to
84)    */
85)   void addToLayer(Layer &layer) const;
86) 
87)   /**
88)    * @brief write all polygons with holes as multiple paths to a layer
89)    * @param[in,out] layer layer to write paths to
90)    */
91)   void writeToLayer(Layer &layer) const;
92) 
93) protected:
Stefan Schuermans implement outer polygon off...

Stefan Schuermans authored 11 years ago

94)   /**
95)    * @brief create outer offset polygon
96)    * @param[in] poly polygon to create outer offset of
97)    * @param[in] offset offset, > 0.0
98)    * @param[out] offsetPoly offset polygon (!= *this)
99)    * @return if outer offset polygon could be constructed
100)    */
101)   static bool createOuterOffsetPoly(const CgPolyHoles &poly, double offset,
102)                                     CgPolyHoles &offsetPoly);
103) 
Stefan Schuermans implement converting polygo...

Stefan Schuermans authored 11 years ago

104)   /**
105)    * @brief add a polygon as path to a layer
106)    * @param[in] poly polygon to add to layer
107)    * @param[in,out] layer layer to add path to
108)    */
109)   static void PolyToLayer(const CgPoly &poly, Layer &layer);
110) 
111)   /**
112)    * @brief add a polygon with holes as multiple paths to a layer
113)    * @param[in] poly polygon with holes to add to layer
114)    * @param[in,out] layer layer to add paths to
115)    */
116)   static void PolyHolesToLayer(const CgPolyHoles &poly, Layer &layer);
117) 
118) public: