From f3d4a9072173e3f1323db2e544430cf0f0113a35 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 20 Jun 2022 16:52:59 +0200 Subject: [PATCH] Fixes to compile on MSVC --- src/libslic3r/BranchingTree/BranchingTree.cpp | 2 +- src/libslic3r/BranchingTree/PointCloud.hpp | 6 +++--- tests/sla_print/sla_print_tests.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/BranchingTree/BranchingTree.cpp b/src/libslic3r/BranchingTree/BranchingTree.cpp index a01163f48..6463a30de 100644 --- a/src/libslic3r/BranchingTree/BranchingTree.cpp +++ b/src/libslic3r/BranchingTree/BranchingTree.cpp @@ -77,7 +77,7 @@ void build_tree(PointCloud &nodes, Builder &builder) case BED: { closest_node.weight = w; if (closest_it->dst_branching > nodes.properties().max_branch_length()) { - auto hl_br_len = float(nodes.properties().max_branch_length()) / 2.; + auto hl_br_len = float(nodes.properties().max_branch_length()) / 2.f; Node new_node {{node.pos.x(), node.pos.y(), node.pos.z() - hl_br_len}, node.Rmin}; new_node.id = int(nodes.next_junction_id()); new_node.weight = nodes.get(node_id).weight + hl_br_len; diff --git a/src/libslic3r/BranchingTree/PointCloud.hpp b/src/libslic3r/BranchingTree/PointCloud.hpp index 1ce4739c3..f99b17990 100644 --- a/src/libslic3r/BranchingTree/PointCloud.hpp +++ b/src/libslic3r/BranchingTree/PointCloud.hpp @@ -34,9 +34,9 @@ inline BoundingBox3Base get_support_cone_bb(const Vec3f &p, const Propert double gnd = props.ground_level() - EPSILON; double h = p.z() - gnd; double phi = PI / 2 - props.max_slope(); - double r = std::min(h * std::tan(phi), props.max_branch_length() * std::sin(phi)); + auto r = float(std::min(h * std::tan(phi), props.max_branch_length() * std::sin(phi))); - Vec3f bb_min = {p.x() - r, p.y() - r, gnd}; + Vec3f bb_min = {p.x() - r, p.y() - r, float(gnd)}; Vec3f bb_max = {p.x() + r, p.y() + r, p.z()}; return {bb_min, bb_max}; @@ -221,7 +221,7 @@ public: namespace bgi = boost::geometry::index; float brln = 2 * m_props.max_branch_length(); BoundingBox3Base bb{{pos.x() - brln, pos.y() - brln, - m_props.ground_level() - EPSILON}, + float(m_props.ground_level() - EPSILON)}, {pos.x() + brln, pos.y() + brln, m_ktree.bounds().max_corner().get()}}; diff --git a/tests/sla_print/sla_print_tests.cpp b/tests/sla_print/sla_print_tests.cpp index 273c3f8f6..4670bf209 100644 --- a/tests/sla_print/sla_print_tests.cpp +++ b/tests/sla_print/sla_print_tests.cpp @@ -185,7 +185,7 @@ bool is_outside_support_cone(const Vec3f &supp, const Vec3f &pt, float angle) TEST_CASE("BranchingSupports::MergePointFinder", "[SLASupportGeneration][Branching]") { SECTION("Identical points have the same merge point") { Vec3f a{0.f, 0.f, 0.f}, b = a; - float slope = PI / 4.f; + auto slope = float(PI / 4.); auto mergept = branchingtree::find_merge_pt(a, b, slope); @@ -200,7 +200,7 @@ TEST_CASE("BranchingSupports::MergePointFinder", "[SLASupportGeneration][Branchi // | b * <= mergept SECTION("Points at different heights have the lower point as mergepoint") { Vec3f a{0.f, 0.f, 0.f}, b = {0.f, 0.f, -1.f}; - float slope = PI / 4.f; + auto slope = float(PI / 4.); auto mergept = branchingtree::find_merge_pt(a, b, slope); @@ -214,7 +214,7 @@ TEST_CASE("BranchingSupports::MergePointFinder", "[SLASupportGeneration][Branchi // * <= mergept SECTION("Points at different X have mergept in the middle at lower Z") { Vec3f a{0.f, 0.f, 0.f}, b = {1.f, 0.f, 0.f}; - float slope = PI / 4.f; + auto slope = float(PI / 4.); auto mergept = branchingtree::find_merge_pt(a, b, slope); @@ -234,7 +234,7 @@ TEST_CASE("BranchingSupports::MergePointFinder", "[SLASupportGeneration][Branchi // * <= mergept SECTION("Points at different Y have mergept in the middle at lower Z") { Vec3f a{0.f, 0.f, 0.f}, b = {0.f, 1.f, 0.f}; - float slope = PI / 4.f; + auto slope = float(PI / 4.); auto mergept = branchingtree::find_merge_pt(a, b, slope); @@ -250,7 +250,7 @@ TEST_CASE("BranchingSupports::MergePointFinder", "[SLASupportGeneration][Branchi SECTION("Points separated by less than critical angle have the lower point as mergept") { Vec3f a{0.f, 0.f, 0.f}, b = {-0.5f, -0.5f, -1.f}; - float slope = PI / 4.f; + auto slope = float(PI / 4.); auto mergept = branchingtree::find_merge_pt(a, b, slope);