V2 cylinders
-
Folks,
One of the BIG goals of V2 is consistency across the API. However, there's an issue with cylinder(), and before making changes we thought a little discussion should take place.
The internal API for V1 Cylinder looks like this...
CSG.cylinder({start: [0, -5, 0], end: [0, 5, 0], radius: 3})
And on top of this, the SCAD-like API looks like this...
cylinder({h: 10, r: 3, center: true})
In order for V2 to be consistent, we would like to move to an API that centers the cylinder by default, and creates a cylinder with the given height and size (radius).
cylinder({height: 10, size: 3})
Personally, I have always wondered why start and end points were required, as translating and rotating a shape into place is far easier to understand.
There is one downside. The ability to create oblique cylinders will only be possible by extruding a circle from start to end points.
Thoughts?
-
@torejorg that is a very good point that we did not consider like that, but perhaps instead of having it as a parameter for cylinders we could (emphasis on "could") have a 'skew' operation (like translate & co), or even just leverage the transform (transformation by a 4x4 matrix) to achieve a similar result ? I am not aware of how limiting/acceptable that would be to be honest
-
@z3dev Maybe add an optional parameter for skew, skewing it along the x-axis? That would keep the api simple but add the option to make an oblique. I think the bottom circle should be kept centered, with the top skewed off-center.
-