implement converting paths...
Stefan Schuermans authored 12 years ago
|
1) /* drawing (DXF) to G-code (NGC) converter
2) * Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
3) * Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/
4) */
5)
6) #ifndef POLYGONS_H
7) #define POLYGONS_H
8)
9) #include <boost/shared_ptr.hpp>
10) #include <vector>
11)
|
implement converting polygo...
Stefan Schuermans authored 12 years ago
|
12) #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
implement converting paths...
Stefan Schuermans authored 12 years ago
|
13) #include <CGAL/Polygon_2.h>
14) #include <CGAL/Polygon_with_holes_2.h>
15)
16) #include "layer.h"
17)
18) /// a set of polygons
19) class Polygons {
20) public:
|
implement converting polygo...
Stefan Schuermans authored 12 years ago
|
21) typedef CGAL::Exact_predicates_inexact_constructions_kernel CgKern;
22)
23) typedef CgKern::Point_2 CgPoint;
24) typedef CGAL::Polygon_2<CgKern> CgPoly;
25) typedef CGAL::Polygon_with_holes_2<CgKern> CgPolyHoles;
26) typedef std::vector<CgPoly> CgPolyVec;
27) typedef std::vector<CgPolyHoles> CgPolyHolesVec;
28) typedef boost::shared_ptr<CgPoly> CgPolyPtr;
29) typedef boost::shared_ptr<CgPolyHoles> CgPolyHolesPtr;
30) typedef std::vector<CgPolyPtr> CgPolyPtrVec;
31) typedef std::vector<CgPolyHolesPtr> CgPolyHolesPtrVec;
|
implement converting paths...
Stefan Schuermans authored 12 years ago
|
32)
33) /**
34) * @brief clear all polygons
35) */
36) void clear();
37)
38) /**
39) * @brief add polygons from layer
40) * @param[in] layer layer to obtain the polygons from
41) * @param[in] eqDist maximum distance of two points to be considered equal
42) * @return if the layer could be converted to polygons and imported
43) */
44) bool addLayer(const Layer &layer, double eqDist);
45)
46) /**
47) * @brief load polygons from layer
48) * @param[in] layer layer to obtain the polygons from
49) * @param[in] eqDist maximum distance of two points to be considered equal
50) * @return if the layer could be converted to polygons and imported
51) */
52) bool loadLayer(const Layer &layer, double eqDist);
53)
|
implement inside cutting (h...
Stefan Schuermans authored 12 years ago
|
54) /**
55) * @brief create inner offset polygons
56) * @param[in] offset offset, > 0.0
57) * @param[out] offsetPolys offset polygons (!= *this)
|
implement outer polygon off...
Stefan Schuermans authored 12 years ago
|
58) * @return if inner offset polygons could be constructed
|
implement inside cutting (h...
Stefan Schuermans authored 12 years ago
|
59) */
|
implement outer polygon off...
Stefan Schuermans authored 12 years ago
|
60) bool createInnerOffset(double offset, Polygons &offsetPolys) const;
61)
62) /**
63) * @brief create outer offset polygons
64) * @param[in] offset offset, > 0.0
65) * @param[out] offsetPolys offset polygons (!= *this)
66) * @return if outer offset polygons could be constructed
67) */
68) bool createOuterOffset(double offset, Polygons &offsetPolys) const;
|
implement inside cutting (h...
Stefan Schuermans authored 12 years ago
|
69)
|
implement converting polygo...
Stefan Schuermans authored 12 years ago
|
70) /**
71) * @brief add all polygons with holes as multiple paths to a layer
72) * @param[in,out] layer layer to add paths to
73) */
74) void addToLayer(Layer &layer) const;
75)
76) /**
77) * @brief write all polygons with holes as multiple paths to a layer
78) * @param[in,out] layer layer to write paths to
79) */
80) void writeToLayer(Layer &layer) const;
81)
82) protected:
|
implement outer polygon off...
Stefan Schuermans authored 12 years ago
|
83) /**
84) * @brief create outer offset polygon
85) * @param[in] poly polygon to create outer offset of
86) * @param[in] offset offset, > 0.0
87) * @param[out] offsetPoly offset polygon (!= *this)
88) * @return if outer offset polygon could be constructed
89) */
90) static bool createOuterOffsetPoly(const CgPolyHoles &poly, double offset,
91) CgPolyHoles &offsetPoly);
92)
|
implement converting polygo...
Stefan Schuermans authored 12 years ago
|
93) /**
94) * @brief add a polygon as path to a layer
95) * @param[in] poly polygon to add to layer
96) * @param[in,out] layer layer to add path to
97) */
98) static void PolyToLayer(const CgPoly &poly, Layer &layer);
99)
100) /**
101) * @brief add a polygon with holes as multiple paths to a layer
102) * @param[in] poly polygon with holes to add to layer
103) * @param[in,out] layer layer to add paths to
104) */
105) static void PolyHolesToLayer(const CgPolyHoles &poly, Layer &layer);
106)
107) public:
|