mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
ENH: optimize area of top surface
Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: Ia3d1be6ad3b9f55ee1acda14d0be955055f6dfcb (cherry picked from commit 448fd3043950613a4d91df256fa9ee52a57fcaca)
This commit is contained in:
parent
9f4a54d280
commit
030d97bf78
3 changed files with 56 additions and 1 deletions
|
@ -350,6 +350,50 @@ void Layer::export_region_fill_surfaces_to_svg_debug(const char *name) const
|
|||
this->export_region_fill_surfaces_to_svg(debug_out_path("Layer-fill_surfaces-%s-%d.svg", name, idx ++).c_str());
|
||||
}
|
||||
|
||||
coordf_t Layer::get_sparse_infill_max_void_area()
|
||||
{
|
||||
double max_void_area = 0.;
|
||||
for (auto layerm : m_regions) {
|
||||
Flow flow = layerm->flow(frInfill);
|
||||
float density = layerm->region().config().sparse_infill_density;
|
||||
InfillPattern pattern = layerm->region().config().sparse_infill_pattern;
|
||||
if (density == 0.)
|
||||
return -1;
|
||||
|
||||
//BBS: rough estimation and need to be optimized
|
||||
double spacing = flow.scaled_spacing() * (100 - density) / density;
|
||||
switch (pattern) {
|
||||
case ipConcentric:
|
||||
case ipRectilinear:
|
||||
case ipLine:
|
||||
case ipGyroid:
|
||||
case ipAlignedRectilinear:
|
||||
case ipOctagramSpiral:
|
||||
case ipHilbertCurve:
|
||||
case ip3DHoneycomb:
|
||||
case ipArchimedeanChords:
|
||||
max_void_area = std::max(max_void_area, spacing * spacing);
|
||||
break;
|
||||
case ipGrid:
|
||||
case ipHoneycomb:
|
||||
case ipLightning:
|
||||
max_void_area = std::max(max_void_area, 4.0 * spacing * spacing);
|
||||
break;
|
||||
case ipCubic:
|
||||
case ipAdaptiveCubic:
|
||||
case ipTriangles:
|
||||
case ipStars:
|
||||
case ipSupportCubic:
|
||||
max_void_area = std::max(max_void_area, 4.5 * spacing * spacing);
|
||||
break;
|
||||
default:
|
||||
max_void_area = std::max(max_void_area, spacing * spacing);
|
||||
break;
|
||||
}
|
||||
};
|
||||
return max_void_area;
|
||||
}
|
||||
|
||||
BoundingBox get_extents(const LayerRegion &layer_region)
|
||||
{
|
||||
BoundingBox bbox;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue