Bitbybit Docs
    Preparing search index...

    Class JSCADHulls

    Wrapping JSCAD geometry in its convex hull, the shape a tight sheet would take around it: hull wraps everything at once and hullChain wraps each consecutive pair, so a row of shapes becomes a bent tube rather than one lump. All inputs of a call must be of the same kind, solids, 2D shapes or paths.

    Index

    Constructors

    hulls

    • Wraps each consecutive pair of inputs in a convex hull and fuses the hulls, so a row of shapes becomes a continuous strand that follows their order.

      A bend in the row is kept, where hull would fill it in. All inputs must be of the same kind.

      Parameters

      • inputs: HullDto

        The solids, 2D shapes or paths, in the order they connect

      Returns Promise<JSCADEntity>

      The chained hull

      const spheres = await bitbybit.jscad.shapes.spheresOnCenterPoints({ centers: [[0, 0, 0], [10, 0, 0], [10, 10, 0]], radius: 1, segments: 16 });
      const strand = await bitbybit.jscad.hulls.hullChain({ meshes: spheres });
    • Wraps all the inputs in one convex hull, the smallest shape without dents that contains them all, regardless of their order.

      All inputs must be of the same kind, solids, 2D shapes or paths.

      Parameters

      • inputs: HullDto

        The solids, 2D shapes or paths

      Returns Promise<JSCADEntity>

      The convex hull

      const wrapped = await bitbybit.jscad.hulls.hull({ meshes: [cube, sphere] });
      
    • Tells whether a solid is convex, meaning it already equals its own hull: every straight line between two of its points stays inside it.

      Solids only; a 2D shape or a path throws an error.

      Parameters

      Returns Promise<boolean>

      True when the solid is convex

      const convex = await bitbybit.jscad.hulls.isConvex({ mesh: shape });