Bitbybit Docs
    Preparing search index...

    Class ManifoldCrossSection

    Flat outlines in the Manifold kernel, the 2D shapes that operations.extrude and operations.revolve turn into solids and that slice and project cut out of them. A cross-section is one or more closed polygons in the XY plane, holes included; shapes builds them, booleans combines them, operations offsets, hulls and extrudes them, transforms moves them and evaluate measures them. The methods here convert between cross-sections and plain point lists, and free the memory a cross-section holds.

    Index

    Constructors

    Properties

    create

    • Builds a cross-section from one polygon given as points; only the X and Y of each point are used.

      fillRule decides which regions of a self-crossing polygon count as inside; removeDuplicates drops consecutive repeated points within tolerance first.

      Parameters

      Returns Promise<CrossSectionPointer>

      The cross-section

      const outline = await bitbybit.manifold.crossSection.crossSectionFromPoints({
      points: [[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]],
      fillRule: Bit.Inputs.Manifold.fillRuleEnum.positive,
      removeDuplicates: false,
      tolerance: 1e-7,
      });
    • Builds a cross-section from several polygons given as points, for instance an outline and its holes; only the X and Y of each point are used.

      fillRule decides which regions count as inside where polygons overlap; removeDuplicates drops consecutive repeated points within tolerance first.

      Parameters

      Returns Promise<CrossSectionPointer>

      The cross-section

      const plate = await bitbybit.manifold.crossSection.crossSectionFromPolygons({
      polygonPoints: [outerPoints, holePoints],
      fillRule: Bit.Inputs.Manifold.fillRuleEnum.evenOdd,
      removeDuplicates: false,
      tolerance: 1e-7,
      });

    decompose

    • Reads a cross-section back as its polygons, each a list of 2D points.

      Parameters

      Returns Promise<Vector2[][]>

      One list of 2D points per polygon

      const polygons = await bitbybit.manifold.crossSection.crossSectionToPolygons({ crossSection: outline });
      
    • Reads a cross-section back as its polygons with 3D points, Z set to 0, ready for drawing as polylines.

      Parameters

      Returns Promise<Point3[][]>

      One list of points per polygon

      const polylines = await bitbybit.manifold.crossSection.crossSectionToPoints({ crossSection: outline });
      
    • Reads several cross-sections back as their polygons, as crossSectionToPolygons does for one.

      Parameters

      Returns Promise<Vector2[][][]>

      One polygon list per cross-section, in the same order

      const polygons = await bitbybit.manifold.crossSection.crossSectionsToPolygons({ crossSections: [outline, hole] });
      
    • Reads several cross-sections back as polygons with 3D points, as crossSectionToPoints does for one.

      Parameters

      Returns Promise<number[][][][]>

      One list of point polygons per cross-section, in the same order

      const polylines = await bitbybit.manifold.crossSection.crossSectionsToPoints({ crossSections: [outline, hole] });