From 3c4f68fa3fac3f1687e8c7f41aea1ccbadc8fa0e Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Mon, 26 Apr 2021 16:26:08 +0200 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFFix:=20change=20.value()=20connected?= =?UTF-8?q?=20with=20optional=20to=20dereferece=20by=20*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Os X do NOT support std::optional::value() PrusaSlicer_OsX_Mojave: ../src/libslic3r/SLA/SupportIslands/ExpandNeighbor.cpp:23:50: error: 'value' is unavailable: introduced in macOS 10.14 --- src/libslic3r/SLA/SupportIslands/ExpandNeighbor.cpp | 2 +- src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp | 2 +- tests/libslic3r/test_voronoi.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/SLA/SupportIslands/ExpandNeighbor.cpp b/src/libslic3r/SLA/SupportIslands/ExpandNeighbor.cpp index aacef93809..260ab27436 100644 --- a/src/libslic3r/SLA/SupportIslands/ExpandNeighbor.cpp +++ b/src/libslic3r/SLA/SupportIslands/ExpandNeighbor.cpp @@ -20,7 +20,7 @@ void ExpandNeighbor::process(CallStack &call_stack) if (circle_opt.has_value()) { size_t circle_index = data.result.circles.size(); data.circle_indexes.push_back(circle_index); - data.result.circles.push_back(circle_opt.value()); + data.result.circles.push_back(*circle_opt); return; } diff --git a/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp b/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp index 7ef7c128cd..179fb0042a 100644 --- a/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp +++ b/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp @@ -252,7 +252,7 @@ Slic3r::Polygon VoronoiGraphUtils::to_polygon(const VD::cell_type & cell, continue; if (orientation == Geometry::Orientation::ORIENTATION_CW) std::swap(line->a, line->b); - lines.push_back(line.value()); + lines.push_back(*line); } while ((edge = edge->next()) && edge != cell.incident_edge()); assert(!lines.empty()); LineUtils::sort_CCW(lines, center); diff --git a/tests/libslic3r/test_voronoi.cpp b/tests/libslic3r/test_voronoi.cpp index 96c236e177..fa2232aab9 100644 --- a/tests/libslic3r/test_voronoi.cpp +++ b/tests/libslic3r/test_voronoi.cpp @@ -2312,10 +2312,10 @@ TEST_CASE("bad vertex cause overflow of data type precisin when use VD result", for (auto &edge : vd.edges()) { size_t i1 = edge.cell()->source_index(); size_t i2 = edge.twin()->cell()->source_index(); - if (i1 == bad_index0 && i2 == bad_index1 || - i1 == bad_index1 && i2 == bad_index0) { - Vec2d p1 = points[bad_index0].cast(); - Vec2d p2 = points[bad_index1].cast(); + if ((i1 == bad_index0 && i2 == bad_index1) || + (i1 == bad_index1 && i2 == bad_index0)) { + Vec2d p1 = points[bad_index0].cast(); + Vec2d p2 = points[bad_index1].cast(); Vec2d middle = (p1 + p2) / 2; // direction for edge is perpendicular point connection Vec2d direction(p2.y() - p1.y(), p1.x() - p2.x());