mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 12:15:53 +08:00
Slight refactor of Organic supports after merge
3d8f84ed76620790eac798cfa2caf17bf0b08f17
This commit is contained in:
parent
f982a91e7b
commit
db77331004
@ -505,7 +505,7 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex
|
|||||||
// 1) Calculate offsets of collision areas in parallel.
|
// 1) Calculate offsets of collision areas in parallel.
|
||||||
std::vector<Polygons> collision_areas_offsetted(max_required_layer + 1 - min_layer_bottom);
|
std::vector<Polygons> collision_areas_offsetted(max_required_layer + 1 - min_layer_bottom);
|
||||||
tbb::parallel_for(tbb::blocked_range<LayerIndex>(min_layer_bottom, max_required_layer + 1),
|
tbb::parallel_for(tbb::blocked_range<LayerIndex>(min_layer_bottom, max_required_layer + 1),
|
||||||
[&outlines, &machine_border = m_machine_border, offset_value = radius + xy_distance, min_layer_bottom, &collision_areas_offsetted, &throw_on_cancel]
|
[&outlines, &machine_border = std::as_const(m_machine_border), offset_value = radius + xy_distance, min_layer_bottom, &collision_areas_offsetted, &throw_on_cancel]
|
||||||
(const tbb::blocked_range<LayerIndex> &range) {
|
(const tbb::blocked_range<LayerIndex> &range) {
|
||||||
for (LayerIndex layer_idx = range.begin(); layer_idx != range.end(); ++ layer_idx) {
|
for (LayerIndex layer_idx = range.begin(); layer_idx != range.end(); ++ layer_idx) {
|
||||||
Polygons collision_areas = machine_border;
|
Polygons collision_areas = machine_border;
|
||||||
@ -684,9 +684,8 @@ void TreeModelVolumes::calculateAvoidance(const std::vector<RadiusLayerPair> &ke
|
|||||||
BOOST_LOG_TRIVIAL(debug) << "Calculation requested for value already calculated?";
|
BOOST_LOG_TRIVIAL(debug) << "Calculation requested for value already calculated?";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((task.to_model && !to_model) || (!task.to_model && !to_build_plate))
|
if ((task.to_model ? to_model : to_build_plate) &&
|
||||||
continue;
|
(! task.holefree() || task.radius < m_increase_until_radius + m_current_min_xy_dist_delta))
|
||||||
if (! task.holefree() || task.radius < m_increase_until_radius + m_current_min_xy_dist_delta)
|
|
||||||
avoidance_tasks.emplace_back(task);
|
avoidance_tasks.emplace_back(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,15 +496,15 @@ static std::optional<std::pair<Point, size_t>> polyline_sample_next_point_at_dis
|
|||||||
Vec2d xf = p0f - foot_pt;
|
Vec2d xf = p0f - foot_pt;
|
||||||
// Squared distance of "start_pt" from the ray (p0, p1).
|
// Squared distance of "start_pt" from the ray (p0, p1).
|
||||||
double l2_from_line = xf.squaredNorm();
|
double l2_from_line = xf.squaredNorm();
|
||||||
double det = dist2 - l2_from_line;
|
// Squared distance of an intersection point of a circle with center at the foot point.
|
||||||
|
if (double l2_intersection = dist2 - l2_from_line;
|
||||||
if (det > - SCALED_EPSILON) {
|
l2_intersection > - SCALED_EPSILON) {
|
||||||
// The ray (p0, p1) touches or intersects a circle centered at "start_pt" with radius "dist".
|
// The ray (p0, p1) touches or intersects a circle centered at "start_pt" with radius "dist".
|
||||||
// Distance of the circle intersection point from the foot point.
|
// Distance of the circle intersection point from the foot point.
|
||||||
double dist_circle_intersection = std::sqrt(std::max(0., det));
|
l2_intersection = std::max(l2_intersection, 0.);
|
||||||
if ((v - foot_pt).cast<double>().norm() > dist_circle_intersection) {
|
if ((v - foot_pt).cast<double>().squaredNorm() >= l2_intersection) {
|
||||||
// Intersection of the circle with the segment (p0, p1) is on the right side (close to p1) from the foot point.
|
// Intersection of the circle with the segment (p0, p1) is on the right side (close to p1) from the foot point.
|
||||||
Point p = p0 + (foot_pt + v * (dist_circle_intersection / sqrt(l2v))).cast<coord_t>();
|
Point p = p0 + (foot_pt + v * sqrt(l2_intersection / l2v)).cast<coord_t>();
|
||||||
validate_range(p);
|
validate_range(p);
|
||||||
return std::pair<Point, size_t>{ p, i - 1 };
|
return std::pair<Point, size_t>{ p, i - 1 };
|
||||||
}
|
}
|
||||||
@ -576,8 +576,7 @@ static std::optional<std::pair<Point, size_t>> polyline_sample_next_point_at_dis
|
|||||||
double next_distance = current_distance;
|
double next_distance = current_distance;
|
||||||
// Get points so that at least min_points are added and they each are current_distance away from each other. If that is impossible, decrease current_distance a bit.
|
// Get points so that at least min_points are added and they each are current_distance away from each other. If that is impossible, decrease current_distance a bit.
|
||||||
// The input are lines, that means that the line from the last to the first vertex does not have to exist, so exclude all points that are on this line!
|
// The input are lines, that means that the line from the last to the first vertex does not have to exist, so exclude all points that are on this line!
|
||||||
while ((next_point = polyline_sample_next_point_at_distance(part.points, current_point, current_index, next_distance)) &&
|
while ((next_point = polyline_sample_next_point_at_distance(part.points, current_point, current_index, next_distance))) {
|
||||||
next_point->second < coord_t(part.size()) - 1) {
|
|
||||||
// Not every point that is distance away, is valid, as it may be much closer to another point. This is especially the case when the overhang is very thin.
|
// Not every point that is distance away, is valid, as it may be much closer to another point. This is especially the case when the overhang is very thin.
|
||||||
// So this ensures that the points are actually a certain distance from each other.
|
// So this ensures that the points are actually a certain distance from each other.
|
||||||
// This assurance is only made on a per polygon basis, as different but close polygon may not be able to use support below the other polygon.
|
// This assurance is only made on a per polygon basis, as different but close polygon may not be able to use support below the other polygon.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user