Reworked algorithm for Voronoi Offset curve extraction.

Now the algorithm is very different from the OpenVoronoi implementation
and hopefully it is now correct (save numerical issues, which will be
a big PITA).
This commit is contained in:
Vojtech Bubnik 2020-06-11 16:09:51 +02:00
parent 9566a05d8f
commit 1c95ceaeaa
7 changed files with 908 additions and 583 deletions

View file

@ -1,3 +1,5 @@
// Polygon offsetting using Voronoi diagram prodiced by boost::polygon.
#ifndef slic3r_VoronoiOffset_hpp_
#define slic3r_VoronoiOffset_hpp_
@ -7,7 +9,16 @@
namespace Slic3r {
Polygons voronoi_offset(const Geometry::VoronoiDiagram &vd, const Lines &lines, double offset_distance, double discretization_error);
// Offset a polygon or a set of polygons possibly with holes by traversing a Voronoi diagram.
// The input polygons are stored in lines and lines are referenced by vd.
// Outer curve will be extracted for a positive offset_distance,
// inner curve will be extracted for a negative offset_distance.
// Circular arches will be discretized to achieve discretization_error.
Polygons voronoi_offset(
const Geometry::VoronoiDiagram &vd,
const Lines &lines,
double offset_distance,
double discretization_error);
} // namespace Slic3r