More efficient and configurable implementation for roundedBox (roundedCube) #66
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 PR changes
roundedBox
to use hull.Using hull makes it much more efficient to compute, and the geometry (rounded cube corners) is more correct without mismatched seams between spheres/cylinders in the corners/edges of the rounded cube.
I also thought it would make most sense to stick to the parameter conventions used by OpenSCAD native modules: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#cube so the following changes where made:
size=[x,y,z]
the new version optionally accepts a single number for size, which applies to all three dimensions.roundedBox
had nocenter
parameter, it was always centered. The new module now provides the option, and defaults to not centered, just as the nativecube
module does.r
is more conventional thanradius
(used by cylinder, sphere etc.) so the new module also usesr
.Since the interface for this module would have changed, I thought it would be best to "deprecate"
roundedBox
by echoing a "warning" statement and name the new moduleroundedCube
so that old scripts using MCAD can remain backwards compatible.