Improve 3D Honeycomb density calculation, clean up code #5078
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is essentially the same as my PrusaSlicer 3D Honeycomb update, with a few little grammar tweaks to fit a little bit nicer into Slic3r.
The main visible fix is adding in some pattern density tweaks to make infill % better match extruded density for a 30mm cube. For infill below 42%, the pattern is pinned to cycle at an integer number of layers, and density is estimated by assuming that an integer number of truncated octahedrons are used (squashed or stretched according to quantisation). Calculations will be less precise for non-rectangular structures (but hopefully within the realms of what people expect).
For infill above 42%, the pattern is simplified to have a consistent alternating layer pattern for all densities, so that density calculation could be modeled at about half-way between a linear pattern and a perfect truncated octahedron pattern.
The infill code has also been rewritten to use a separate triangle wave and truncated octahedron wave function, and I've added an ASCII figure to help explain the critical point selection. This may help for future improvements (e.g. creating a concentric version of this infill pattern).
As the density calculation has been altered, this will have different GCode from the previous version in Slicer, although the visible appearance should be similar.