wip on branching tree avoidance
again
This commit is contained in:
parent
6238595ac6
commit
234167534b
@ -76,7 +76,17 @@ void build_tree(PointCloud &nodes, Builder &builder)
|
||||
switch (type) {
|
||||
case BED: {
|
||||
closest_node.weight = w;
|
||||
if ((routed = builder.add_ground_bridge(node, closest_node))) {
|
||||
if (closest_it->dst_branching > nodes.properties().max_branch_length()) {
|
||||
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;
|
||||
new_node.left = node.id;
|
||||
if ((routed = builder.add_bridge(node, new_node))) {
|
||||
size_t new_idx = nodes.insert_junction(new_node);
|
||||
ptsqueue.push(new_idx);
|
||||
}
|
||||
} else if ((routed = builder.add_ground_bridge(node, closest_node))) {
|
||||
closest_node.left = closest_node.right = node_id;
|
||||
nodes.get(closest_node_id) = closest_node;
|
||||
nodes.mark_unreachable(closest_node_id);
|
||||
|
@ -105,6 +105,12 @@ public:
|
||||
// Add an anchor bridge to the model body
|
||||
virtual bool add_mesh_bridge(const Node &from, const Node &to) = 0;
|
||||
|
||||
virtual std::optional<Vec3f> suggest_avoidance(const Node &from,
|
||||
float max_bridge_len)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
// Report nodes that can not be routed to an endpoint (model or ground)
|
||||
virtual void report_unroutable(const Node &j) = 0;
|
||||
|
||||
|
@ -29,7 +29,7 @@ class BranchingTreeBuilder: public branchingtree::Builder {
|
||||
|
||||
// Scaling of the input value 'widening_factor:<0, 1>' to produce resonable
|
||||
// widening behaviour
|
||||
static constexpr double WIDENING_SCALE = 0.02;
|
||||
static constexpr double WIDENING_SCALE = 0.05;
|
||||
|
||||
double get_radius(const branchingtree::Node &j) const
|
||||
{
|
||||
@ -99,9 +99,10 @@ class BranchingTreeBuilder: public branchingtree::Builder {
|
||||
int suppid_left = branchingtree::Node::ID_NONE;
|
||||
int suppid_right = branchingtree::Node::ID_NONE;
|
||||
|
||||
double glvl = ground_level(m_sm);
|
||||
branchingtree::Node dst = node;
|
||||
dst.weight += node.pos.z();
|
||||
dst.Rmin = std::max(node.Rmin, dst.Rmin);
|
||||
dst.pos.z() = glvl;
|
||||
dst.weight += node.pos.z() - glvl;
|
||||
|
||||
if (node.left >= 0 && add_ground_bridge(m_cloud.get(node.left), dst))
|
||||
ret.to_left = false;
|
||||
@ -144,8 +145,18 @@ public:
|
||||
bool add_mesh_bridge(const branchingtree::Node &from,
|
||||
const branchingtree::Node &to) override;
|
||||
|
||||
std::optional<Vec3f> suggest_avoidance(const branchingtree::Node &from,
|
||||
float max_bridge_len) override;;
|
||||
|
||||
void report_unroutable(const branchingtree::Node &j) override
|
||||
{
|
||||
double glvl = ground_level(m_sm);
|
||||
branchingtree::Node dst = j;
|
||||
dst.pos.z() = glvl;
|
||||
dst.weight += j.pos.z() - glvl;
|
||||
if (add_ground_bridge(j, dst))
|
||||
return;
|
||||
|
||||
BOOST_LOG_TRIVIAL(warning) << "Cannot route junction at " << j.pos.x()
|
||||
<< " " << j.pos.y() << " " << j.pos.z();
|
||||
|
||||
@ -279,6 +290,32 @@ bool BranchingTreeBuilder::add_mesh_bridge(const branchingtree::Node &from,
|
||||
return bool(anchor);
|
||||
}
|
||||
|
||||
static std::optional<Vec3f> get_avoidance(const GroundConnection &conn,
|
||||
float maxdist)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<Vec3f> BranchingTreeBuilder::suggest_avoidance(
|
||||
const branchingtree::Node &from, float max_bridge_len)
|
||||
{
|
||||
double glvl = ground_level(m_sm);
|
||||
branchingtree::Node dst = from;
|
||||
dst.pos.z() = glvl;
|
||||
dst.weight += from.pos.z() - glvl;
|
||||
bool succ = add_ground_bridge(from, dst);
|
||||
|
||||
std::optional<Vec3f> ret;
|
||||
|
||||
if (succ) {
|
||||
auto it = m_gnd_connections.find(from.id);
|
||||
if (it != m_gnd_connections.end())
|
||||
ret = get_avoidance(it->second, max_bridge_len);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void build_pillars(SupportTreeBuilder &builder,
|
||||
BranchingTreeBuilder &vbuilder,
|
||||
const SupportableMesh &sm)
|
||||
|
@ -547,7 +547,7 @@ Vec3d check_ground_route(
|
||||
auto gndhit = beam_mesh_hit(policy, sm.emesh, gndbeam, sd);
|
||||
double gnd_hit_d = std::min(gndhit.distance(), down_l + EPSILON);
|
||||
|
||||
if (std::isinf(gndhit.distance()) && sm.cfg.object_elevation_mm < EPSILON) {
|
||||
if (gndhit.distance() > down_l && sm.cfg.object_elevation_mm < EPSILON) {
|
||||
// Dealing with zero elevation mode, to not route pillars
|
||||
// into the gap between the optional pad and the model
|
||||
double gap = std::sqrt(sm.emesh.squared_distance(gp));
|
||||
|
@ -862,6 +862,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
||||
|| opt_key == "supports_enable"
|
||||
|| opt_key == "support_tree_type"
|
||||
|| opt_key == "support_object_elevation"
|
||||
|| opt_key == "branchingsupport_object_elevation"
|
||||
|| opt_key == "pad_around_object"
|
||||
|| opt_key == "pad_around_object_everywhere"
|
||||
|| opt_key == "slice_closing_radius"
|
||||
@ -888,6 +889,24 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
||||
|| opt_key == "support_max_bridge_length"
|
||||
|| opt_key == "support_max_pillar_link_distance"
|
||||
|| opt_key == "support_base_safety_distance"
|
||||
|
||||
|| opt_key == "branchingsupport_head_front_diameter"
|
||||
|| opt_key == "branchingsupport_head_penetration"
|
||||
|| opt_key == "branchingsupport_head_width"
|
||||
|| opt_key == "branchingsupport_pillar_diameter"
|
||||
|| opt_key == "branchingsupport_pillar_widening_factor"
|
||||
|| opt_key == "branchingsupport_small_pillar_diameter_percent"
|
||||
|| opt_key == "branchingsupport_max_weight_on_model"
|
||||
|| opt_key == "branchingsupport_max_bridges_on_pillar"
|
||||
|| opt_key == "branchingsupport_pillar_connection_mode"
|
||||
|| opt_key == "branchingsupport_buildplate_only"
|
||||
|| opt_key == "branchingsupport_base_diameter"
|
||||
|| opt_key == "branchingsupport_base_height"
|
||||
|| opt_key == "branchingsupport_critical_angle"
|
||||
|| opt_key == "branchingsupport_max_bridge_length"
|
||||
|| opt_key == "branchingsupport_max_pillar_link_distance"
|
||||
|| opt_key == "branchingsupport_base_safety_distance"
|
||||
|
||||
|| opt_key == "pad_object_gap"
|
||||
) {
|
||||
steps.emplace_back(slaposSupportTree);
|
||||
|
Loading…
Reference in New Issue
Block a user