Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More efficient and configurable implementation for roundedBox (roundedCube) #66

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

thehans
Copy link
Member

@thehans thehans commented Nov 11, 2019

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:

  1. In addition to size=[x,y,z] the new version optionally accepts a single number for size, which applies to all three dimensions.
  2. roundedBox had no center parameter, it was always centered. The new module now provides the option, and defaults to not centered, just as the native cube module does.
  3. minor change but parameter name r is more conventional than radius (used by cylinder, sphere etc.) so the new module also uses r.

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 module roundedCube so that old scripts using MCAD can remain backwards compatible.

@hyperair hyperair merged commit 07f4e22 into openscad:master Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants