Stefan
revert to inexact construction kernel for polygon offsetting because it is way faster
Stefan commited 6471f40 at 2013-07-13 21:04:24
/* drawing (DXF) to G-code (NGC) converter
* Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
*/
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/create_offset_polygons_from_polygon_with_holes_2.h>
#include <CGAL/create_straight_skeleton_from_polygon_with_holes_2.h>
#include "layer.h"
#include "path.h"
#include "point.h"
#include "polygons.h"
/**
* @brief clear all polygons
*/
void Polygons::clear()
{
mPolys.clear();
}
/**
* @brief add polygons from layer
* @param[in] layer layer to obtain the polygons from
* @param[in] eqDist maximum distance of two points to be considered equal
* @return if the layer could be converted to polygons and imported
*/
bool Polygons::addLayer(const Layer &layer, double eqDist)
{
// convert all paths to simple polygons
// once using exact construction kernel (needed by intersection, difference)
// once using inexact construction kernel (faster offsetting)
CgExPolyVec simplesEx;
CgPolyVec simples;
Layer::Paths::const_iterator path;
for (path = layer.mPaths.begin(); path != layer.mPaths.end(); ++path) {
// skip empty paths and paths with just one point
if (path->mPoints.size() <= 1)
continue;
// check that path is closed
if (!path->mPoints.front().equals(path->mPoints.back(), eqDist)) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX