3c3d9187e96a9356f551472a826748d5432c6c79
Stefan Schuermans initial version, DXFs can b...

Stefan Schuermans authored 11 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 TRAVERSE_H
7) #define TRAVERSE_H
8) 
Stefan Schuermans implement finer approximati...

Stefan Schuermans authored 11 years ago

9) #include <dime/entities/Arc.h>
10) #include <dime/entities/Circle.h>
11) #include <dime/entities/Ellipse.h>
Stefan Schuermans initial version, DXFs can b...

Stefan Schuermans authored 11 years ago

12) #include <dime/entities/Entity.h>
13) #include <dime/State.h>
Stefan Schuermans implement finer approximati...

Stefan Schuermans authored 11 years ago

14) #include <dime/util/Linear.h>
Stefan Schuermans initial version, DXFs can b...

Stefan Schuermans authored 11 years ago

15) 
16) #include "drawing.h"
Stefan Schuermans implement finer approximati...

Stefan Schuermans authored 11 years ago

17) #include "layer.h"
Stefan Schuermans initial version, DXFs can b...

Stefan Schuermans authored 11 years ago

18) 
19) /// context structure for traverse entities callback
20) struct traverse_ctx {
Stefan Schuermans implement finer approximati...

Stefan Schuermans authored 11 years ago

21)   double  precision;  ///< precision for conversion to lines
Stefan Schuermans initial version, DXFs can b...

Stefan Schuermans authored 11 years ago

22)   Drawing *mpDrawing; ///< the drawing to add the entities to
23) };
24) 
25) /**
26)  * @brief process an entity during DXF traversal
27)  * @param[in] state current state of libdime
28)  * @param[in] entity pointer to entity
29)  * @param[in] vp_ctx context pointer, must point to traverse_ctx structure
30)  * @return if to continue enumeration
31)  */
Stefan Schuermans implement finer approximati...

Stefan Schuermans authored 11 years ago

32) bool traverse_entity(const class dimeState *const state, dimeEntity *entity,
Stefan Schuermans initial version, DXFs can b...

Stefan Schuermans authored 11 years ago

33)                      void *vp_ctx);
34) 
Stefan Schuermans implement finer approximati...

Stefan Schuermans authored 11 years ago

35) /**
36)  * @brief process a generic geometric object during DXF traversal
37)  * @param[in] entity pointer to entity
38)  * @param[in] matrix current DXF transformation matrix
39)  * @param[in] layer layer to add the entitiy to
40)  */
41) void traverse_generic(dimeEntity *entity, const dimeMatrix &matrix,
42)                       Layer &layer);
43) 
44) /**
45)  * @brief process an arc during DXF traversal
46)  * @param[in] circle pointer to arc entity
47)  * @param[in] matrix current DXF transformation matrix
48)  * @param[in] precision precision for conversion to lines
49)  * @param[in] layer layer to add the entitiy to
50)  */
51) void traverse_arc(dimeArc *arc, const dimeMatrix &matrix,
52)                   double precision, Layer &layer);
53) 
54) /**
55)  * @brief process a circle during DXF traversal
56)  * @param[in] circle pointer to circle entity
57)  * @param[in] matrix current DXF transformation matrix
58)  * @param[in] precision precision for conversion to lines
59)  * @param[in] layer layer to add the entitiy to
60)  */
61) void traverse_circle(dimeCircle *circle, const dimeMatrix &matrix,
62)                      double precision, Layer &layer);
63) 
64) /**
65)  * @brief process an ellipse during DXF traversal
66)  * @param[in] circle pointer to ellipse entity
67)  * @param[in] matrix current DXF transformation matrix
68)  * @param[in] precision precision for conversion to lines
69)  * @param[in] layer layer to add the entitiy to
70)  */
71) void traverse_ellipse(dimeEllipse *ellipse, const dimeMatrix &matrix,
72)                       double precision, Layer &layer);
73) 
74) /**
75)  * @brief add a circle to the layer
76)  * @param[in] center center point
77)  * @param[in] radius radius
78)  * @param[in] start start angle in radians
79)  * @param[in] end end angle in radians
80)  * @param[in] precision precision for conversion to lines
81)  * @param[in] matrix current DXF transformation matrix
82)  * @param[in] layer layer to add the entitiy to
83)  */
84) void traverse_add_circle(const dimeVec3f &center,
85)                          double radius, double start, double end,
86)                          double precision, const dimeMatrix &matrix,
87)                          Layer &layer);
88) 
89) /**
90)  * @brief add an ellipse to the layer
91)  * @param[in] center center point
92)  * @param[in] majorEnd endpoint of major axis
93)  * @param[in] ratio ratio of minor to major axis
94)  * @param[in] start start angle in radians
95)  * @param[in] end end angle in radians
96)  * @param[in] precision precision for conversion to lines
97)  * @param[in] matrix current DXF transformation matrix
98)  * @param[in] layer layer to add the entitiy to
99)  */
100) void traverse_add_ellipse(const dimeVec3f &center, const dimeVec3f &majorEnd,
101)                           double ratio, double start, double end,
102)                           double precision, const dimeMatrix &matrix,
103)                           Layer &layer);
104) 
105) /**
106)  * @brief calculate number of segments to approx. part of circle/ellipse with
107)  * @param[in] maxRadius radius of circle / maximum radius of ellipse
108)  * @param[in] start start angle in radians
109)  * @param[in] end end angle in radians
110)  * @param[in] precision precision for conversion to lines
111)  * @return number of segments to approximate circle/ellipse with
112)  */
113) unsigned int traverse_calc_num_seg(double maxRadius, double start, double end,
114)                                    double precision);
115)