mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 08:17:51 -06:00
optimize cross hatch infill to enchance strength (#5495)
Optimize the cross-hatch infill pattern to improve strength when low infill density is used.
This commit is contained in:
parent
c14ae13788
commit
8b1bf13021
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "../ClipperUtils.hpp"
|
#include "../ClipperUtils.hpp"
|
||||||
#include "../ShortestPath.hpp"
|
#include "../ShortestPath.hpp"
|
||||||
#include "../Surface.hpp"
|
#include "../Surface.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "FillCrossHatch.hpp"
|
#include "FillCrossHatch.hpp"
|
||||||
|
|
||||||
|
@ -193,7 +194,12 @@ void FillCrossHatch ::_fill_surface_single(
|
||||||
bb.merge(align_to_grid(bb.min, Point(line_spacing * 4, line_spacing * 4)));
|
bb.merge(align_to_grid(bb.min, Point(line_spacing * 4, line_spacing * 4)));
|
||||||
|
|
||||||
// generate pattern
|
// generate pattern
|
||||||
Polylines polylines = generate_infill_layers(scale_(this->z), 1, line_spacing, bb.size()(0), bb.size()(1));
|
//Orca: optimize the cross-hatch infill pattern to improve strength when low infill density is used.
|
||||||
|
double repeat_ratio = 1.0;
|
||||||
|
if (params.density < 0.3)
|
||||||
|
repeat_ratio = std::clamp(1.0 - std::exp(-5 * params.density), 0.2, 1.0);
|
||||||
|
|
||||||
|
Polylines polylines = generate_infill_layers(scale_(this->z), repeat_ratio, line_spacing, bb.size()(0), bb.size()(1));
|
||||||
|
|
||||||
// shift the pattern to the actual space
|
// shift the pattern to the actual space
|
||||||
for (Polyline &pl : polylines) { pl.translate(bb.min); }
|
for (Polyline &pl : polylines) { pl.translate(bb.min); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue