V2 Hulls

  • It's official!

    V2 includes hull for 3D geometries, as well as 2D geometries. This has been long overdue, and one of the most requested features over the past few years.

    Big thanks to @jallwine and @hg42 for the initial V1 versions.

    Example of hull for 3D geometories


    Example of hull_chain for 3D geometries


  • @z3dev for my purposes the type of api doesn't matter much, because I use a preprocessor (currently python, may be something like livescript in the future) that can generate whatever I need. Ideally I would use the lowest level.

    That said, I could eventually use javascript as a frontend directly. It's a whole different situation with jscad compared to openscad as a backend.

    My preprocessor generates a tree internally (which seems to be very similar to the vtree).
    So, the transition to jscad could also be from my tree to vtree...

    btw. I already created a new thread for further discussions, because I thought it would not fit well under "V2 hulls"):

  • @hg42 You would be welcome to start working with V2. Somethings have changed, and the shift to a functional approach allows others to build upon the 'core' API.

    I've already created an object layer for those that miss that style. It's still 'work in progress' as well. 🙂

  • @z3dev well, 14 days seems to be quick in relation to my replay after 5 month ☺

    Meanwhile, I read some code and other sources. I see it's a work in progress (naturally) and several things probably don't work any more or at least temporarily.

    The code above helps to understand, what is your current way to test code. Actually, I wasn't fully aware of the pure functional interface.

  • Wow! Sorry for the late reply..

    Here's the V2 code that produced those shapes using both hull() and hullChain() functions.

    const {primitives, hulls, color} = require('@jscad/modeling')
    const {translate} = require('@jscad/modeling').transforms
    const main = () => {
      const g1 = primitives.cuboid({size: [4,4,4]})
      const g2 = translate([15, 15, 15], primitives.cuboid({size: [10,10,10]}))
      const g3 = translate([20, 0, 0], primitives.cuboid({size: [4,4,4]}))
      const g4 = translate([35, 15, 15], primitives.ellipsoid({radius: [5,5,5], segments: 16}))
      const g5 = translate([40, 0, 0], primitives.ellipsoid({radius: [2,2,2], segments: 16}))
      const g6 = translate([55, 15, 15], primitives.ellipsoid({radius: [5,5,5], segments: 16}))
      // various hulls between different shapes
      const s1 = hulls.hull(g1, g2)
      color.color([1,0.5,0], s1)
      const s2 = hulls.hull(g3, g4)
      color.color([0,1,0.5], s2)
      const s3 = hulls.hull(g5, g6)
      color.color([0.5,0,1], s3)
      return [s1,s2,s3]
      // example of hullChain between three shapes
      // const s1 = hulls.hullChain(g1,g4,g5)
      // return s1
    module.exports = {main}

  • Hi,

    after being offline from JSCAD for some time now, I am slowly trying to get back to a new working environment, now using V2. I know it's not production ready, which doesn't matter for me, it's only an exploration and I also want to help with testing or ideas etc.

    While having several issues currently (mainly understanding how to do things in V2 and current status of the new code), it would probably help (me), if you could post the code you used for these images (or a pointer to it).

Log in to reply