jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.58k stars 505 forks source link

feat(modeling): remove extrudeRectangular #1273

Closed platypii closed 10 months ago

platypii commented 11 months ago

This might be controversial. Let's use this PR for discussion on removing extrudeRectangular from V3.

The extrudeRectangular function is supposed to:

Extrude the given geometry by following the outline(s) with a rectangle.

But it's not doing that. If you "follow the outline(s) with a rectangle" you would get something more like the red shape, but extrudeRectangular returns the shape on the right:

extrude-rect

In reality extrudeRectangular is basically just doing:

extrudeLinear({}, offset({}, geometry))

This is not easy to fix, so I suggest that we simply delete extrudeRectangular. I would be surprised if anyone is using it, but if they are, they can use offset+extrude instead.

I think what was really intended here was a stroke function like the suggestion in #1272

All Submissions:

z3dev commented 11 months ago

@platypii interesting. i really didn't like this extrude function from day one as, as you mentioned, is just putting two functions together. users should be able to figure out how to do this through a simple example.

i also don't like 'torus' either, as that is simply extrude rotate with a sphere. it makes no sense to implement primitives via complex functionality. primitives should exist by themselves. examples should show how to create a torus.

platypii commented 11 months ago

Rebased to fix merge conflicts.

Can anyone tell me what exactly is "rectangular" about extrudeRectangular?

z3dev commented 11 months ago

Rebased to fix merge conflicts.

Can anyone tell me what exactly is "rectangular" about extrudeRectangular?

Nope. You could go back and look at V1, which may have had the same issues, or different issues.

V2 allows 'corners' to be passed into extrudeRectangular() as well. So there are a few more options.

z3dev commented 10 months ago

From CSG.js V1... math/Path2.js

// Expand the path to a CAG
// This traces the path with a circle with radius pathradius
expandToCAG: function (pathradius, resolution) {
}
platypii commented 10 months ago

Earliest I could find was this commit from 2012: joostn/OpenJsCad@b059ed95

So... can we kill it? :fire: