Bitbybit Docs
    Preparing search index...

    Class CrossSectionShapes

    Building Manifold cross-sections, the flat outlines that become solids: squares, rectangles, circles and outlines from raw polygons. They lie in the XY plane; center places a shape on the origin, otherwise its corner sits there.

    Index

    Constructors

    base

    primitives

    Constructors

    base

    • Builds a cross-section from polygons given as 2D points, fusing overlapping ones so the result has no crossings.

      fillRule decides which regions count as inside where polygons overlap or a polygon crosses itself.

      Parameters

      Returns Promise<CrossSectionPointer>

      The cross-section

      const outline = await bitbybit.manifold.crossSection.shapes.create({ polygons: [[[0, 0], [10, 0], [10, 10], [0, 10]]], fillRule: Bit.Inputs.Manifold.fillRuleEnum.evenOdd });
      

    primitives

    • Creates a square cross-section of the given side; with center true it is centered on the origin, otherwise its corner sits there.

      Parameters

      Returns Promise<CrossSectionPointer>

      The square cross-section

      const square = await bitbybit.manifold.crossSection.shapes.square({ size: 10, center: true });
      
    • Creates a circular cross-section of the given radius, centered on the origin and drawn with circularSegments straight sides.

      Parameters

      Returns Promise<CrossSectionPointer>

      The circle cross-section

      const disc = await bitbybit.manifold.crossSection.shapes.circle({ radius: 5, circularSegments: 64 });
      
    • Creates a rectangular cross-section with length along X and height along Y; with center true it is centered on the origin, otherwise its corner sits there.

      Parameters

      Returns Promise<CrossSectionPointer>

      The rectangle cross-section

      const rectangle = await bitbybit.manifold.crossSection.shapes.rectangle({ length: 20, height: 10, center: true });