Skip to content

Commit

Permalink
Remove void version of buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
eyal0 committed Jul 1, 2020
1 parent 33f013b commit 7a42e5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
15 changes: 0 additions & 15 deletions bg_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ namespace bg_helpers {
// convert back afterward, if needed. Also, they work if expand_by is
// 0, unlike bg::buffer.
const int points_per_circle = 32;
template<typename CoordinateType>
void buffer(multi_polygon_type_fp const & geometry_in, multi_polygon_type_fp & geometry_out, CoordinateType expand_by) {
if (expand_by == 0) {
bg::convert(geometry_in, geometry_out);
} else {
bg::buffer(geometry_in, geometry_out,
bg::strategy::buffer::distance_symmetric<CoordinateType>(expand_by),
bg::strategy::buffer::side_straight(),
bg::strategy::buffer::join_round(points_per_circle),
bg::strategy::buffer::end_round(points_per_circle),
bg::strategy::buffer::point_circle(points_per_circle));
}
}

template void buffer(const multi_polygon_type_fp&, multi_polygon_type_fp&, double);

multi_polygon_type_fp buffer(multi_polygon_type_fp const & geometry_in, coordinate_type_fp expand_by) {
if (expand_by == 0) {
Expand Down
3 changes: 0 additions & 3 deletions bg_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ namespace bg_helpers {
// always convert to floating-point before doing work, if needed, and
// convert back afterward, if needed. Also, they work if expand_by is
// 0, unlike bg::buffer.
template<typename CoordinateType>
void buffer(multi_polygon_type_fp const & geometry_in, multi_polygon_type_fp & geometry_out, CoordinateType expand_by);

multi_polygon_type_fp buffer(multi_polygon_type_fp const & geometry_in, coordinate_type_fp expand_by);

template<typename CoordinateType>
Expand Down
11 changes: 4 additions & 7 deletions surface_vectorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ vector<pair<coordinate_type_fp, vector<shared_ptr<icoords>>>> Surface_vectorial:
vector<vector<pair<linestring_type_fp, bool>>> new_trace_toolpaths(trace_count);

for (size_t trace_index = 0; trace_index < trace_count; trace_index++) {
multi_polygon_type_fp already_milled_shrunk;
bg_helpers::buffer(already_milled[trace_index], already_milled_shrunk, -tool_diameter/2 + tolerance);
multi_polygon_type_fp already_milled_shrunk =
bg_helpers::buffer(already_milled[trace_index], -tool_diameter/2 + tolerance);
if (tool_index < tool_count - 1) {
// Don't force isolation. By pretending that an area around
// the trace is already milled, it will be removed from
Expand Down Expand Up @@ -924,9 +924,7 @@ vector<multi_polygon_type_fp> Surface_vectorial::offset_polygon(
if (!input) {
// This means that we are milling a thermal so we need to move inward
// slightly to accommodate the thickness of the millbit.
multi_polygon_type_fp temp;
bg_helpers::buffer(masked_milling_poly, temp, -diameter/2 - offset);
masked_milling_poly = temp;
masked_milling_poly = bg_helpers::buffer(masked_milling_poly, -diameter/2 - offset);
}
// This is the area that the milling must not cross so that it
// doesn't dig into the trace. We only need this if there is an
Expand Down Expand Up @@ -981,8 +979,7 @@ vector<multi_polygon_type_fp> Surface_vectorial::offset_polygon(
}

multi_polygon_type_fp mpoly;
multi_polygon_type_fp mpoly_temp;
bg_helpers::buffer(masked_milling_polys, mpoly_temp, expand_by + offset);
multi_polygon_type_fp mpoly_temp = bg_helpers::buffer(masked_milling_polys, expand_by + offset);
if (expand_by + offset == 0) {
mpoly = mpoly_temp;
} else {
Expand Down

0 comments on commit 7a42e5d

Please sign in to comment.