Bitbybit Docs
    Preparing search index...

    Class CrossSectionOperations

    Working with Manifold cross-sections beyond booleans: turning them into solids by extruding along Z or revolving, offsetting their outlines, wrapping them in a convex hull, simplifying them, and composing and decomposing them. Every method returns a new shape.

    Index

    Constructors

    basic

    • Sweeps a cross-section along Z into a solid of the given height.

      twistDegrees turns the top against the bottom, scaleTopX and scaleTopY shrink or grow it, and nDivisions adds sections in between so twists and tapers stay smooth; 0 for both top scales makes a cone. center centers the solid on the XY plane instead of standing it on it.

      Parameters

      Returns Promise<ManifoldPointer>

      The extruded solid

      const twisted = await bitbybit.manifold.crossSection.operations.extrude({ crossSection: square, height: 20, nDivisions: 20, twistDegrees: 90, scaleTopX: 0.5, scaleTopY: 0.5, center: false });
      
    • Spins a cross-section around the Y axis into a solid, like a lathe; only the part of the outline on the positive X side is used.

      revolveDegrees below 360 gives a partial turn and circularSegments sets how round the result is. The kernel stands the result along Z; matchProfile, true by default, turns it back to match the profile.

      Parameters

      Returns Promise<ManifoldPointer>

      The revolved solid

      const vase = await bitbybit.manifold.crossSection.operations.revolve({ crossSection: profile, revolveDegrees: 360, circularSegments: 64, matchProfile: true });
      
    • Moves the outline of a cross-section outward by delta, or inward for a negative delta, so an outer contour grows and a hole shrinks.

      joinType says how corners are treated: rounded, squared off, mitered or beveled; miterLimit caps how far a miter may reach and circularSegments how round a rounded corner is. simplify afterwards cleans up tiny segments.

      Parameters

      Returns Promise<CrossSectionPointer>

      The offset cross-section

      const bigger = await bitbybit.manifold.crossSection.operations.offset({ crossSection: outline, delta: 1, joinType: Bit.Inputs.Manifold.manifoldJoinTypeEnum.round, miterLimit: 2, circularSegments: 32 });
      
    • Removes points of a cross-section that lie within epsilon of the line between their neighbors, dropping near-duplicates and collinear points.

      A larger epsilon removes more; run it after offset to clean up the tiny segments offsetting leaves behind.

      Parameters

      Returns Promise<CrossSectionPointer>

      The simplified cross-section

      const cleaner = await bitbybit.manifold.crossSection.operations.simplify({ crossSection: offsetOutline, epsilon: 1e-4 });
      

    composition

    • Packs several cross-sections or polygons into one cross-section without fusing them, the inverse of decompose.

      Parameters

      Returns Promise<CrossSectionPointer>

      One cross-section holding all of them

      const packed = await bitbybit.manifold.crossSection.operations.compose({ polygons: [square, disc] });