EdgeGrid refactoring to support both open and closed contours.

Squashed commit of the following:

commit 4e13a8fe19abcc9aae39a9bc4c7953a743196504
Merge: 6ae766409 6f89da1f3
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Fri Feb 5 11:19:35 2021 +0100

    Merge remote-tracking branch 'remotes/origin/master' into vb_edgegrid_open_lines

commit 6ae76640942269993c942861f0444088843e3fa1
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Fri Feb 5 11:14:48 2021 +0100

    EdgeGrid enhancement to accept both the open and closed lines.

commit 36a5efcd558bd5fd5f46b5f561387a2c73221553
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Fri Feb 5 10:52:14 2021 +0100

    EdgeGrid improvements: Documentation, one bug fix after recent refactoring.

commit 6f89da1f39
Author: tamasmeszaros <meszaros.q@gmail.com>
Date:   Thu Feb 4 20:31:50 2021 +0100

    Disable libicu for boost-regex

    Should have been disabled from the beginning

commit ffc77b1a72a0be9b5622fd33defeebb24bf07b34
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Thu Feb 4 18:40:33 2021 +0100

    EdgeGrid: Annotated those methods that do not work with open contours.

commit 8039a645b4bf0c46c99b90a9c34e7189d7442f86
Author: Vojtech Bubnik <bubnikv@gmail.com>
Date:   Thu Feb 4 18:28:21 2021 +0100

    Refactoring of EdgeGrid structure to support both closed and open lines.
This commit is contained in:
Vojtech Bubnik 2021-02-05 11:20:04 +01:00
parent 6f89da1f39
commit 5f86d11c74
6 changed files with 272 additions and 187 deletions

View file

@ -230,14 +230,11 @@ static Polylines connect_brim_lines(Polylines &&polylines, const Polygons &brim_
if (polylines.empty())
return Polylines();
std::vector<Points> polylines_points(polylines.size() + brim_area.size());
for (const Polyline &poly : polylines)
polylines_points[&poly - &polylines.front()] = poly.points;
for (const Polygon &poly : brim_area)
polylines_points.emplace_back(poly.points);
BoundingBox bbox = get_extents(polylines);
bbox.merge(get_extents(brim_area));
EdgeGrid::Grid grid(get_extents(polylines).inflated(SCALED_EPSILON));
grid.create(polylines_points, coord_t(scale_(10.)));
EdgeGrid::Grid grid(bbox.inflated(SCALED_EPSILON));
grid.create(brim_area, polylines, coord_t(scale_(10.)));
struct Visitor
{