JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    V2 cylinders

    Development Discussions
    3
    4
    2172
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • z3dev
      z3dev last edited by

      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?

      z3dev 1 Reply Last reply Reply Quote 0
      • kaosat-dev
        kaosat-dev @torejorg last edited by

        @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 something like this

        1 Reply Last reply Reply Quote 0
        • torejorg
          torejorg @z3dev last edited by

          @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.

          kaosat-dev 1 Reply Last reply Reply Quote 0
          • z3dev
            z3dev @z3dev last edited by

            0_1558258628895_42929F1D-C41F-4D5A-825B-C4BD6D912100.png

            torejorg 1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB | Contributors