diff options
author | Casper Lamboo <c.lamboo@ultimaker.com> | 2022-04-20 17:38:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-20 17:38:34 +0300 |
commit | b3123ff6350fd06dfe82ea9670baf2059b9c01e4 (patch) | |
tree | aa2563325e633615774b16996d25faf7c1837585 | |
parent | bb0dfd893f43e9e867c8cab0e57a451c08310311 (diff) |
Apply suggestions from code review
Co-authored-by: Jelle Spijker <j.spijker@ultimaker.com>
-rw-r--r-- | src/TreeSupport.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/TreeSupport.cpp b/src/TreeSupport.cpp index 3cc74d400..5329bab6a 100644 --- a/src/TreeSupport.cpp +++ b/src/TreeSupport.cpp @@ -381,13 +381,13 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes) }(); const ClosestPolygonPoint to_outside = PolygonUtils::findClosest(node.position, collision); - bool node_is_tip = node.distance_to_top <= tip_layers; + const bool node_is_tip = node.distance_to_top <= tip_layers; coord_t max_inside_dist = branch_radius_node; if (node_is_tip) { // if the node is part of the tip allow the branch to travel through the support xy distance max_inside_dist += (tip_layers - node.distance_to_top) * maximum_move_distance; } - if (vSize2(node.position - to_outside.location) >= max_inside_dist * max_inside_dist) //Too far inside. + if (vSize2(node.position - to_outside.location) >= max_inside_dist * max_inside_dist) // Too far inside. { if (! support_rests_on_model) { @@ -429,9 +429,10 @@ void TreeSupport::dropNodes(std::vector<std::vector<Node*>>& contact_nodes) }(); //Avoid collisions. - const coord_t maximum_move_between_samples = maximum_move_distance + radius_sample_resolution + 100; //100 micron extra for rounding errors. - Polygons avoidance = group_index == 0 ? volumes_.getAvoidance(branch_radius_node, layer_nr - 1) : volumes_.getCollision(branch_radius_node, layer_nr - 1); - PolygonUtils::moveOutside(avoidance, next_layer_vertex, radius_sample_resolution + 100, maximum_move_between_samples * maximum_move_between_samples); + constexpr size_t rounding_compensation = 100; + const coord_t maximum_move_between_samples = maximum_move_distance + radius_sample_resolution + rounding_compensation; + const Polygons avoidance = group_index == 0 ? volumes_.getAvoidance(branch_radius_node, layer_nr - 1) : volumes_.getCollision(branch_radius_node, layer_nr - 1); + PolygonUtils::moveOutside(avoidance, next_layer_vertex, radius_sample_resolution + rounding_compensation, maximum_move_between_samples * maximum_move_between_samples); const bool to_buildplate = !volumes_.getAvoidance(branch_radius_node, layer_nr - 1).inside(next_layer_vertex); Node* next_node = new Node(next_layer_vertex, node.distance_to_top + 1, node.skin_direction, node.support_roof_layers_below - 1, to_buildplate, p_node); |