mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 15:35:55 +08:00
Don't call search_ground_route for every ground point candidate
search_ground_route already tries to find a suitable ground point globally from the source. Different destination arguments will not help much but will cause a lot of redundant cpu burning SPE-1303
This commit is contained in:
parent
8c2ac9d83b
commit
bef64ecec0
@ -5,7 +5,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "libslic3r/SLA/SupportTreeUtils.hpp"
|
#include "libslic3r/TriangleMesh.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace branchingtree {
|
namespace Slic3r { namespace branchingtree {
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <admesh/stl.h>
|
#include <admesh/stl.h>
|
||||||
|
|
||||||
#include "libslic3r/ExPolygon.hpp"
|
#include "libslic3r/ExPolygon.hpp"
|
||||||
#include "libslic3r/BoundingBox.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r { namespace branchingtree {
|
namespace Slic3r { namespace branchingtree {
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ class BranchingTreeBuilder: public branchingtree::Builder {
|
|||||||
const SupportableMesh &m_sm;
|
const SupportableMesh &m_sm;
|
||||||
const branchingtree::PointCloud &m_cloud;
|
const branchingtree::PointCloud &m_cloud;
|
||||||
|
|
||||||
|
std::set<int /*ground node_id that was already processed*/> m_ground_mem;
|
||||||
|
|
||||||
// Scaling of the input value 'widening_factor:<0, 1>' to produce resonable
|
// Scaling of the input value 'widening_factor:<0, 1>' to produce resonable
|
||||||
// widening behaviour
|
// widening behaviour
|
||||||
static constexpr double WIDENING_SCALE = 0.02;
|
static constexpr double WIDENING_SCALE = 0.02;
|
||||||
@ -156,11 +158,21 @@ bool BranchingTreeBuilder::add_merger(const branchingtree::Node &node,
|
|||||||
bool BranchingTreeBuilder::add_ground_bridge(const branchingtree::Node &from,
|
bool BranchingTreeBuilder::add_ground_bridge(const branchingtree::Node &from,
|
||||||
const branchingtree::Node &to)
|
const branchingtree::Node &to)
|
||||||
{
|
{
|
||||||
bool ret = search_ground_route(ex_tbb, m_builder, m_sm,
|
bool ret = false;
|
||||||
|
|
||||||
|
auto it = m_ground_mem.find(from.id);
|
||||||
|
if (it == m_ground_mem.end()) {
|
||||||
|
ret = search_ground_route(ex_tbb, m_builder, m_sm,
|
||||||
sla::Junction{from.pos.cast<double>(),
|
sla::Junction{from.pos.cast<double>(),
|
||||||
get_radius(from)},
|
get_radius(from)},
|
||||||
get_radius(to)).first;
|
get_radius(to)).first;
|
||||||
|
|
||||||
|
// Remember that this node was tested if can go to ground, don't
|
||||||
|
// test it with any other destination ground point because
|
||||||
|
// it is unlikely that search_ground_route would find a better solution
|
||||||
|
m_ground_mem.insert(from.id);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
build_subtree(from.id);
|
build_subtree(from.id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user