Closed z3dev closed 5 years ago
It's time for another long discussion. I added notes to those primitives with issues.
It's my feeliing that primitives should be just that, and not rely upon other operations to produce geometry. For example 'torus' seems like a primitive but relies upon 'extrudeRotate'. This is a special compound shape, and may be better packaged as part of 'extrusions'.
@kaosat-dev You will like this... it seems that the logic inside sphere() was actually for ellipsoid(), but had the X, Y, Z radius set to the same value. I changed things, exposing ellipsoid as a primitive.
very cool @z3dev ! I am currently reviewing, thanks for the awesome work, will post back in a bit
@kaosat-dev What to do with polygon? The API is still very SCAD-like, and very confusing. I'm not sure why the complex logic for lists-of-lists was required.
@z3dev can you please explain a bit more about what you mean by list of lists ?
@kaosat-dev You will like this... it seems that the logic inside sphere() was actually for ellipsoid(), but had the X, Y, Z radius set to the same value. I changed things, exposing ellipsoid as a primitive.
Haha that is good indeed !
@z3dev can you please explain a bit more about what you mean by list of lists ?
polygon() needs some help...
i think this is unsupportable as written. there are many issues with rotation, hole detection, etc.
polgyon()
it should follow polyhedron, and ONLY use named options; 'points' and 'paths' DONE
roundedCube() needs to be rewritten as well. There are precision errors if the resolution is adjusted to a sphere that is not planiar with X,Y,Z. For example.
let obj = CSG.roundedCube({radius: [5,10,15], roundradius: 3, resolution: 6});
@z3dev good job on the naming of polyhedron: for now I would keep it 'as it is ' for the rest and revisit later : that function is used A LOT for all stl & other format imports, so breaking things even further can wait ? what do you think ?
about roundedCube: ah yes, lots of pitfalls ! (I even recall that we had notes about that one ?) also just thought about something : I think it should be roundingSegments or roundSegments for the rounding 'resolution' to make it clearer About the precison errors, set of incompatible parameters: can they be caught and an error be thrown or are there realistically too many issues ?
polygon() : so breaking things even further can wait ? what do you think ?
Sounds like a good suggestion. Let's run with the latest. There could be a few more changes coming.
WOW. That was one major pull request!
I'm fine with merging now.
@kaosat-dev This is now done, unless you want further changes.
This was epic, thanks a ton @z3dev ! WELL DONE ! merging :)
This pull request adds the 2D and 3D primitives as a separate module. The goals are:
Major Changes:
Primitives:
arc
circle (alias of ellipse, see ellipse.js)
cube (alias of cuboid, see cuboid.js)
cuboid
cylinder (alias of cylinderElliptic, see cylinderElliptic.js)
cylinderElliptic
ellipse
ellipsoid
geodesicSphere
line
polygon
polyhedron
rectangle
roundedCuboid
roundedCylinder.js
roundedRectangle
sphere (alias of ellipsoid, see ellipsoid.js)
square (alias of rectangle, see rectangle.js)
star
torus