switch res for large printer

This commit is contained in:
SoftFever
2024-05-12 23:35:41 +08:00
parent 3e9a46c5bb
commit 5daecf3583
21 changed files with 92 additions and 62 deletions

View File

@@ -542,7 +542,7 @@ void SkeletalTrapezoidation::generateToolpaths(std::vector<VariableWidthLines> &
export_graph_to_svg(debug_out_path("ST-updateIsCentral-final-%d.svg", iRun), this->graph, this->outline);
#endif
filterCentral(central_filter_dist);
filterCentral(central_filter_dist());
#ifdef ARACHNE_DEBUG
export_graph_to_svg(debug_out_path("ST-filterCentral-final-%d.svg", iRun), this->graph, this->outline);
@@ -729,7 +729,7 @@ void SkeletalTrapezoidation::filterNoncentralRegions()
BOOST_LOG_TRIVIAL(warning) << "Encountered an uninitialized bead at the boundary!";
}
assert(edge.to->data.bead_count >= 0 || edge.to->data.distance_to_boundary == 0);
constexpr coord_t max_dist = scaled<coord_t>(0.4);
const coord_t max_dist = scaled<coord_t>(0.4);
filterNoncentralRegions(&edge, edge.to->data.bead_count, 0, max_dist);
}
}
@@ -1303,6 +1303,7 @@ static inline Point normal(const Point& p0, coord_t len)
void SkeletalTrapezoidation::applyTransitions(ptr_vector_t<std::list<TransitionEnd>>& edge_transition_ends)
{
const auto _snap_dist = snap_dist();
for (edge_t& edge : graph.edges)
{
if (edge.twin->data.hasTransitionEnds())
@@ -1348,7 +1349,7 @@ void SkeletalTrapezoidation::applyTransitions(ptr_vector_t<std::list<TransitionE
coord_t new_node_bead_count = transition_end.is_lower_end? transition_end.lower_bead_count : transition_end.lower_bead_count + 1;
coord_t end_pos = transition_end.pos;
node_t* close_node = (end_pos < ab_size / 2)? from : to;
if ((end_pos < snap_dist || end_pos > ab_size - snap_dist)
if ((end_pos < _snap_dist || end_pos > ab_size - _snap_dist)
&& close_node->data.bead_count == new_node_bead_count
)
{
@@ -1390,6 +1391,7 @@ bool SkeletalTrapezoidation::isEndOfCentral(const edge_t& edge_to) const
void SkeletalTrapezoidation::generateExtraRibs()
{
const auto _snap_dist = snap_dist();
for (auto edge_it = graph.edges.begin(); edge_it != graph.edges.end(); ++edge_it)
{
edge_t& edge = *edge_it;
@@ -1433,7 +1435,7 @@ void SkeletalTrapezoidation::generateExtraRibs()
assert(end_pos > 0);
assert(end_pos < ab_size);
node_t* close_node = (end_pos < ab_size / 2)? from : to;
if ((end_pos < snap_dist || end_pos > ab_size - snap_dist)
if ((end_pos < _snap_dist || end_pos > ab_size - _snap_dist)
&& close_node->data.bead_count == new_node_bead_count
)
{
@@ -1593,6 +1595,7 @@ SkeletalTrapezoidation::edge_t* SkeletalTrapezoidation::getQuadMaxRedgeTo(edge_t
void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upward_quad_mids, ptr_vector_t<BeadingPropagation>& node_beadings)
{
const auto _central_filter_dist = central_filter_dist();
for (auto upward_quad_mids_it = upward_quad_mids.rbegin(); upward_quad_mids_it != upward_quad_mids.rend(); ++upward_quad_mids_it)
{
edge_t* upward_edge = *upward_quad_mids_it;
@@ -1609,7 +1612,7 @@ void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upwar
{ // Only propagate to places where there is place
continue;
}
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, central_filter_dist)) && "zero difference R edges should always be central");
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, _central_filter_dist)) && "zero difference R edges should always be central");
coord_t length = (upward_edge->to->p - upward_edge->from->p).cast<int64_t>().norm();
BeadingPropagation upper_beading = lower_beading;
upper_beading.dist_to_bottom_source += length;
@@ -1839,7 +1842,7 @@ std::shared_ptr<SkeletalTrapezoidationJoint::BeadingPropagation> SkeletalTrapezo
{
if (node->data.bead_count == -1)
{ // This bug is due to too small central edges
constexpr coord_t nearby_dist = scaled<coord_t>(0.1);
const coord_t nearby_dist = scaled<coord_t>(0.1);
auto nearest_beading = getNearestBeading(node, nearby_dist);
if (nearest_beading)
{

View File

@@ -65,8 +65,10 @@ class SkeletalTrapezoidation
coord_t transition_filter_dist; //!< Filter transition mids (i.e. anchors) closer together than this
coord_t allowed_filter_deviation; //!< The allowed line width deviation induced by filtering
coord_t beading_propagation_transition_dist; //!< When there are different beadings propagated from below and from above, use this transitioning distance
static constexpr coord_t central_filter_dist = scaled<coord_t>(0.02); //!< Filter areas marked as 'central' smaller than this
static constexpr coord_t snap_dist = scaled<coord_t>(0.02); //!< Generic arithmatic inaccuracy. Only used to determine whether a transition really needs to insert an extra edge.
//!< Filter areas marked as 'central' smaller than this
inline coord_t central_filter_dist() { return scaled<coord_t>(0.02); }
//!< Generic arithmatic inaccuracy. Only used to determine whether a transition really needs to insert an extra edge.
inline coord_t snap_dist() { return scaled<coord_t>(0.02); }
/*!
* The strategy to use to fill a certain shape with lines.

View File

@@ -261,7 +261,7 @@ void fixSelfIntersections(const coord_t epsilon, Polygons &thiss)
// Points too close to line segments should be moved a little away from those line segments, but less than epsilon,
// so at least half-epsilon distance between points can still be guaranteed.
constexpr coord_t grid_size = scaled<coord_t>(2.);
const coord_t grid_size = scaled<coord_t>(2.);
auto query_grid = createLocToLineGrid(thiss, grid_size);
const auto move_dist = std::max<int64_t>(2L, half_epsilon - 2);
@@ -473,11 +473,11 @@ const std::vector<VariableWidthLines> &WallToolPaths::generate()
if (this->inset_count < 1)
return toolpaths;
const coord_t smallest_segment = Slic3r::Arachne::meshfix_maximum_resolution;
const coord_t allowed_distance = Slic3r::Arachne::meshfix_maximum_deviation;
const coord_t smallest_segment = Slic3r::Arachne::meshfix_maximum_resolution();
const coord_t allowed_distance = Slic3r::Arachne::meshfix_maximum_deviation();
const coord_t epsilon_offset = (allowed_distance / 2) - 1;
const double transitioning_angle = Geometry::deg2rad(m_params.wall_transition_angle);
constexpr coord_t discretization_step_size = scaled<coord_t>(0.8);
const coord_t discretization_step_size = scaled<coord_t>(0.8);
// Simplify outline for boost::voronoi consumption. Absolutely no self intersections or near-self intersections allowed:
// TODO: Open question: Does this indeed fix all (or all-but-one-in-a-million) cases for manifold but otherwise possibly complex polygons?
@@ -692,9 +692,9 @@ void WallToolPaths::simplifyToolPaths(std::vector<VariableWidthLines> &toolpaths
{
for (size_t toolpaths_idx = 0; toolpaths_idx < toolpaths.size(); ++toolpaths_idx)
{
const int64_t maximum_resolution = Slic3r::Arachne::meshfix_maximum_resolution;
const int64_t maximum_deviation = Slic3r::Arachne::meshfix_maximum_deviation;
const int64_t maximum_extrusion_area_deviation = Slic3r::Arachne::meshfix_maximum_extrusion_area_deviation; // unit: μm²
const int64_t maximum_resolution = Slic3r::Arachne::meshfix_maximum_resolution();
const int64_t maximum_deviation = Slic3r::Arachne::meshfix_maximum_deviation();
const int64_t maximum_extrusion_area_deviation = Slic3r::Arachne::meshfix_maximum_extrusion_area_deviation(); // unit: μm²
for (auto& line : toolpaths[toolpaths_idx])
{
line.simplify(maximum_resolution * maximum_resolution, maximum_deviation * maximum_deviation, maximum_extrusion_area_deviation);

View File

@@ -16,9 +16,9 @@ namespace Slic3r::Arachne
{
constexpr bool fill_outline_gaps = true;
constexpr coord_t meshfix_maximum_resolution = scaled<coord_t>(0.5);
constexpr coord_t meshfix_maximum_deviation = scaled<coord_t>(0.025);
constexpr coord_t meshfix_maximum_extrusion_area_deviation = scaled<coord_t>(2.);
inline coord_t meshfix_maximum_resolution() { return scaled<coord_t>(0.5); }
inline coord_t meshfix_maximum_deviation() { return scaled<coord_t>(0.025); }
inline coord_t meshfix_maximum_extrusion_area_deviation() { return scaled<coord_t>(2.); }
class WallToolPathsParams
{