BlinkenArea - GitList
Repositories
Blog
Wiki
dxfngc
Code
Commits
Branches
Tags
Search
Tree:
3c3d918
Branches
Tags
master
dxfngc
src
traverse.h
implement finer approximation for circles and arcs on import, implement import of ellipses
Stefan Schuermans
commited
3c3d918
at 2013-01-29 23:06:23
traverse.h
Blame
History
Raw
/* drawing (DXF) to G-code (NGC) converter * Copyright 2013 Stefan Schuermans <stefan@schuermans.info> * Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/ */ #ifndef TRAVERSE_H #define TRAVERSE_H #include <dime/entities/Arc.h> #include <dime/entities/Circle.h> #include <dime/entities/Ellipse.h> #include <dime/entities/Entity.h> #include <dime/State.h> #include <dime/util/Linear.h> #include "drawing.h" #include "layer.h" /// context structure for traverse entities callback struct traverse_ctx { double precision; ///< precision for conversion to lines Drawing *mpDrawing; ///< the drawing to add the entities to }; /** * @brief process an entity during DXF traversal * @param[in] state current state of libdime * @param[in] entity pointer to entity * @param[in] vp_ctx context pointer, must point to traverse_ctx structure * @return if to continue enumeration */ bool traverse_entity(const class dimeState *const state, dimeEntity *entity, void *vp_ctx); /** * @brief process a generic geometric object during DXF traversal * @param[in] entity pointer to entity * @param[in] matrix current DXF transformation matrix * @param[in] layer layer to add the entitiy to */ void traverse_generic(dimeEntity *entity, const dimeMatrix &matrix, Layer &layer); /** * @brief process an arc during DXF traversal * @param[in] circle pointer to arc entity * @param[in] matrix current DXF transformation matrix * @param[in] precision precision for conversion to lines * @param[in] layer layer to add the entitiy to */ void traverse_arc(dimeArc *arc, const dimeMatrix &matrix, double precision, Layer &layer); /** * @brief process a circle during DXF traversal * @param[in] circle pointer to circle entity * @param[in] matrix current DXF transformation matrix * @param[in] precision precision for conversion to lines * @param[in] layer layer to add the entitiy to */ void traverse_circle(dimeCircle *circle, const dimeMatrix &matrix, double precision, Layer &layer); /** * @brief process an ellipse during DXF traversal * @param[in] circle pointer to ellipse entity * @param[in] matrix current DXF transformation matrix * @param[in] precision precision for conversion to lines * @param[in] layer layer to add the entitiy to */ void traverse_ellipse(dimeEllipse *ellipse, const dimeMatrix &matrix, double precision, Layer &layer); /** * @brief add a circle to the layer * @param[in] center center point * @param[in] radius radius * @param[in] start start angle in radians * @param[in] end end angle in radians * @param[in] precision precision for conversion to lines * @param[in] matrix current DXF transformation matrix * @param[in] layer layer to add the entitiy to */ void traverse_add_circle(const dimeVec3f ¢er, double radius, double start, double end, double precision, const dimeMatrix &matrix, Layer &layer); /** * @brief add an ellipse to the layer * @param[in] center center point * @param[in] majorEnd endpoint of major axis * @param[in] ratio ratio of minor to major axis * @param[in] start start angle in radians * @param[in] end end angle in radians * @param[in] precision precision for conversion to lines * @param[in] matrix current DXF transformation matrix * @param[in] layer layer to add the entitiy to */ void traverse_add_ellipse(const dimeVec3f ¢er, const dimeVec3f &majorEnd, double ratio, double start, double end, double precision, const dimeMatrix &matrix, Layer &layer); /** * @brief calculate number of segments to approx. part of circle/ellipse with * @param[in] maxRadius radius of circle / maximum radius of ellipse * @param[in] start start angle in radians * @param[in] end end angle in radians * @param[in] precision precision for conversion to lines * @return number of segments to approximate circle/ellipse with */ unsigned int traverse_calc_num_seg(double maxRadius, double start, double end, double precision); #endif // #ifndef TRAVERSE_H