Bitbybit Docs
    Preparing search index...

    Class OCCTVoronoiBeta

    Voronoi cells of seed points, built as exact shapes in a face or a solid: cells, the edges and faces between them, Delaunay joins, perforated faces, frames and hollow walls, beams and their graph, closed-cell and open-cell foam and a compsolid; seeds placed at random, on a grid or evenly spaced; and affectors whose field grades any of it.

    Each cell is the part of the face or solid nearer its seed than any other. Weights make power cells, where a heavier seed's cell grows. Most methods have a twin that also reports what was built. Lengths are in model units.

    Experimental: the methods and the report may still change.

    Index

    Constructors

    beams

    • Beta

      Puts a beam on every edge of the Voronoi cells of seeds in a planar face, each shared edge once, with a sphere at each node.

      A beam is a cylinder, or a prism of sides flat sides; nothing is fused. build graph builds only the edges. Curved pieces of the face's boundary get no beam.

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      A compound of the beams and spheres, or of the edges

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds2d({ face, method: Bit.Inputs.OCCT.voronoiSeedMethodEnum.poisson, maxSpacing: 12, relax: 3 });
      const beams = await bitbybit.occt.patterns.voronoi.beams2d({ face, seeds, radius: 1, sides: 6 });
    • Beta

      Puts beams on the cells' edges in a planar face as beams2d does, and reports each cell, each beam and sphere, and the beams as a graph.

      The graph gives the nodes, the struts between them and every radius, ready for analysis.

      Parameters

      Returns Promise<ShapeWithVoronoiBeamsReport2d<TopoDSCompoundPointer>>

      The compound of the beams and spheres, or of the edges, and the report

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.beams2dWithReport({ face, seeds: [[-30, 0, -10], [10, 0, 15], [25, 0, -20]], radius: 1, build: Bit.Inputs.OCCT.voronoiBeamBuildEnum.graph });
      console.log(report.nodes.length, report.struts.length);
    • Beta

      Puts a beam on every edge of the Voronoi cells of seeds in a convex solid, each shared edge once, with a sphere at each node: a strut lattice.

      A beam is a cylinder, or a prism of sides flat sides; nothing is fused. build graph builds only the edges. sizes grade the radii one seed at a time.

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      A compound of the beams and spheres, or of the edges

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds3d({ shape: box, count: 20, relax: 2 });
      const lattice = await bitbybit.occt.patterns.voronoi.beams3d({ shape: box, seeds, radius: 0.8 });
    • Beta

      Puts beams on the cells' edges in a convex solid as beams3d does, and reports each cell, each beam and sphere, and the beams as a graph.

      The graph gives the nodes, the struts between them and every radius, ready for analysis.

      Parameters

      Returns Promise<ShapeWithVoronoiBeamsReport3d<TopoDSCompoundPointer>>

      The compound of the beams and spheres, or of the edges, and the report

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.beams3dWithReport({ shape: box, seeds: [[-10, -10, -10], [12, -8, 5], [-6, 14, 9]], build: Bit.Inputs.OCCT.voronoiBeamBuildEnum.graph });
      console.log(report.nodes.length, report.struts.length);

    cells

    • Beta

      Splits a planar face into the Voronoi cells of seeds, each the part nearer its seed than any other.

      faces gives one face a cell, edges each shared edge once. A convex face of straight edges is cut exactly; any other takes a boolean per cell crossing its boundary, and a cell it splits keeps several faces.

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      A compound of the cells' faces or edges

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const seeds = [[-30, 0, -10], [10, 0, 15], [25, 0, -20], [-5, 0, 20]];
      const cells = await bitbybit.occt.patterns.voronoi.cells2d({ face, seeds, output: Bit.Inputs.OCCT.voronoiCells2dOutputEnum.edges });
    • Beta

      Splits a planar face into Voronoi cells as cells2d does, and reports each seed's cell and each piece of the compound.

      The report gives each cell's state, area, placement and centroid, the seeds and walls of each piece, and how many booleans cutting the cells to the face took.

      Parameters

      Returns Promise<ShapeWithVoronoiReport2d<TopoDSCompoundPointer>>

      The compound of the cells' faces or edges, and the report

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.cells2dWithReport({ face, seeds: [[-30, 0, -10], [10, 0, 15], [25, 0, -20]] });
      console.log(report.cells.map(cell => cell.area), report.booleans);
    • Beta

      Splits a solid into the Voronoi cells of seeds, each the part nearer its seed than any other.

      solids gives one solid a cell, faces and edges each shared face or edge once. A convex solid of planar faces is cut exactly; any other takes a boolean per cell crossing its boundary and refuses faces and edges.

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      A compound of the cells' solids, faces or edges

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const seeds = [[-10, -10, -10], [12, -8, 5], [-6, 14, 9], [9, 11, -12]];
      const cells = await bitbybit.occt.patterns.voronoi.cells3d({ shape: box, seeds, output: Bit.Inputs.OCCT.voronoiCells3dOutputEnum.solids });
    • Beta

      Splits a solid into Voronoi cells as cells3d does, and reports each seed's cell and each piece of the compound.

      The report gives each cell's state, volume, placement and centroid, the seeds and walls of each piece, and how many booleans cutting the cells to the solid took.

      Parameters

      Returns Promise<ShapeWithVoronoiReport3d<TopoDSCompoundPointer>>

      The compound of the cells' solids, faces or edges, and the report

      const sphere = await bitbybit.occt.shapes.solid.createSphere({ radius: 20, center: [0, 0, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.cells3dWithReport({ shape: sphere, seeds: [[-8, 0, 0], [8, 2, 0], [0, 9, 5]] });
      console.log(report.cells.map(cell => cell.volume), report.booleans);

    compsolid

    • Beta

      Builds the Voronoi cells of seeds in a convex solid as one compsolid, whose cells share every vertex, edge and face they meet along.

      Each face between two cells is one face of both, so the cells stay joined without a boolean, as analysis and meshing across cells need.

      Parameters

      Returns Promise<TopoDSCompSolidPointer>

      The compsolid of the cells

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds3d({ shape: box, count: 10, seed: 7 });
      const cells = await bitbybit.occt.patterns.voronoi.compSolid({ shape: box, seeds });

    delaunay

    • Beta

      Joins the seeds whose Voronoi cells meet inside a planar face, by the edges or triangles of their Delaunay triangulation.

      edges joins every two seeds whose cells share an edge, triangles every three whose cells meet at a point. In a face that is not convex, seeds whose cells meet only outside it stay apart.

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      A compound of the edges or triangles, on the face's plane

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const seeds = [[-30, 0, -10], [10, 0, 15], [25, 0, -20], [-5, 0, 20]];
      const triangles = await bitbybit.occt.patterns.voronoi.delaunay2d({ face, seeds, output: Bit.Inputs.OCCT.voronoiDelaunayOutputEnum.triangles });
    • Beta

      Joins seeds as delaunay2d does, and reports each seed's cell and the seeds each edge or triangle joins.

      The report gives each cell's state, area, placement and centroid, the seeds of each piece, and how many booleans reading a face that is not convex took.

      Parameters

      Returns Promise<ShapeWithVoronoiReport2d<TopoDSCompoundPointer>>

      The compound of the edges or triangles, and the report

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.delaunay2dWithReport({ face, seeds: [[-30, 0, -10], [10, 0, 15], [25, 0, -20]] });
      console.log(report.pieces.map(piece => piece.seeds));

    field

    • Beta

      Makes a shape an affector: points, curves, faces, shells or solids whose nearness grades cells, through field and the seed methods.

      Its influence is strength at the shape and falls to 0 at radius. A solid or closed shell gives full influence everywhere inside it unless mode is surface.

      Parameters

      Returns Promise<VoronoiAffector<TopoDSShapePointer>>

      The affector, ready for field, seeds2d and seeds3d

      const hole = await bitbybit.occt.shapes.edge.createCircleEdge({ radius: 10, center: [0, 0, 0], direction: [0, 1, 0] });
      const near = await bitbybit.occt.patterns.voronoi.affector({ shape: hole, radius: 30, falloff: Bit.Inputs.OCCT.voronoiFalloffEnum.smooth });
      const values = await bitbybit.occt.patterns.voronoi.field({ points: [[0, 0, 20], [0, 0, 40]], affectors: [near] });
    • Beta

      Gives the affectors' combined influence at each point, mapped linearly from 0 and 1 onto from and to.

      This is how anything is graded: read the field at the seeds and pass the values on as sizes, weights or perforation factors. For openings 0 keeps a cell solid and 1 opens it most.

      Parameters

      Returns Promise<number[]>

      One value a point

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds2d({ face, count: 60, relax: 2 });
      const hole = await bitbybit.occt.shapes.edge.createCircleEdge({ radius: 8, center: [0, 0, 0], direction: [0, 1, 0] });
      const near = await bitbybit.occt.patterns.voronoi.affector({ shape: hole, radius: 30, falloff: Bit.Inputs.OCCT.voronoiFalloffEnum.smooth });
      const factors = await bitbybit.occt.patterns.voronoi.field({ points: seeds, affectors: [near], from: 0.8, to: 0.2 });
      const panel = await bitbybit.occt.patterns.voronoi.perforate({ face, seeds, factors });

    foam

    • Beta

      Makes a solid into foam: one solid holding a void in each seed's Voronoi cell, the cell scaled by scale or inset by inset.

      Voids keep skin from the outside; windows joins them through a window in each face two voids share, for open-cell foam. In a solid that is not convex only cells wholly inside get a void.

      Parameters

      Returns Promise<TopoDSSolidPointer>

      The one solid, its voids as inner shells

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds3d({ shape: box, count: 30, relax: 2 });
      const foam = await bitbybit.occt.patterns.voronoi.foam({ shape: box, seeds, scale: 0.7, skin: 1 });
      const open = await bitbybit.occt.patterns.voronoi.foam({ shape: box, seeds, scale: 0.7, skin: 1, windows: Bit.Inputs.OCCT.voronoiWindowsEnum.scale, windowScale: 0.5 });
    • Beta

      Makes a solid into foam as foam does, and reports what became of each seed's cell and void.

      Each void's fate says whether it was made, kept closed, not wholly inside, too close to the outside or without a cell; a made void gives its volume and the windows it opens.

      Parameters

      Returns Promise<ShapeWithVoronoiFoamReport<TopoDSSolidPointer>>

      The one solid, and the report

      const sphere = await bitbybit.occt.shapes.solid.createSphere({ radius: 20, center: [0, 0, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.foamWithReport({ shape: sphere, seeds: [[-6, 0, 0], [6, 2, 0], [0, 7, 4], [0, -6, -5]], scale: 0.6, skin: 2 });
      console.log(report.cells.map(cell => cell.voidFate));

    frames

    • Beta

      Builds every face between the Voronoi cells of seeds in a convex solid once, each with a window scaled by scale or inset by inset, its corners rounded by radius.

      With a wall, each cell is a hollow solid instead, its windows tunnels to its inside, so neighbours touch face to face and never overlap.

      Parameters

      Returns Promise<TopoDSCompoundPointer>

      A compound of the frames as faces, or of the hollow cells as solids

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds3d({ shape: box, count: 12, seed: 3 });
      const frames = await bitbybit.occt.patterns.voronoi.frames3d({ shape: box, seeds, scale: 0.6, radius: 1 });
      const cells = await bitbybit.occt.patterns.voronoi.frames3d({ shape: box, seeds, scale: 0.6, wall: Bit.Inputs.OCCT.voronoiWallEnum.scale, thickness: 0.15 });
    • Beta

      Frames the faces between Voronoi cells as frames3d does, and reports each seed's cell and each frame or hollow cell.

      Each frame gives the cells or wall it lies between, the scale or inset its window took, and whether it has one; with a wall, each cell whether it is hollow and how many windows it opened or closed.

      Parameters

      Returns Promise<ShapeWithVoronoiFramesReport<TopoDSCompoundPointer>>

      The compound of the frames or hollow cells, and the report

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.frames3dWithReport({ shape: box, seeds: [[-10, -10, -10], [12, -8, 5], [-6, 14, 9]], shrink: Bit.Inputs.OCCT.voronoiShrinkEnum.inset, inset: 2 });
      console.log(report.pieces.filter(piece => !piece.window).length);

    perforate

    • Beta

      Perforates a planar face with one hole a seed's Voronoi cell, each cell shrunk by scale about its centroid or by inset along its edges, its corners rounded by radius.

      The result is the same face with the holes as inner wires, made without a boolean. A hole closer than margin to the face's boundary is left out.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face with its holes

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const seeds = [[-30, 0, -10], [10, 0, 15], [25, 0, -20], [-5, 0, 20]];
      const panel = await bitbybit.occt.patterns.voronoi.perforate({ face, seeds, shrink: Bit.Inputs.OCCT.voronoiShrinkEnum.inset, inset: 2, radius: 3, margin: 4 });
      const plate = await bitbybit.occt.operations.extrude({ shape: panel, direction: [0, 2, 0] });
    • Beta

      Perforates a planar face as perforate does, and reports what became of each seed's cell and hole.

      Each hole's fate says whether it was made, consumed by the shrink, too close to the boundary or without a cell; a made hole gives its area and how many of its corners took a smaller radius.

      Parameters

      Returns Promise<ShapeWithPerforationReport<TopoDSFacePointer>>

      The face with its holes, and the report

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const { shape, report } = await bitbybit.occt.patterns.voronoi.perforateWithReport({ face, seeds: [[-30, 0, -10], [10, 0, 15], [25, 0, -20]], scale: 0.7, margin: 3 });
      console.log(report.cells.map(cell => cell.hole.fate));

    seeds

    • Beta

      Places seeds in a planar face: at random, on a jittered grid, or evenly spaced by Poisson sampling, whose spacing affectors can grade; then evens them out by relax rounds.

      The same seed gives the same seeds, so a design stays put between runs.

      Parameters

      Returns Promise<Bit.Inputs.Base.Point3[]>

      The seeds, on the face's plane

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 100, length: 60, center: [0, 0, 0], direction: [0, 1, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds2d({ face, method: Bit.Inputs.OCCT.voronoiSeedMethodEnum.poisson, maxSpacing: 10, relax: 3 });
      const cells = await bitbybit.occt.patterns.voronoi.cells2d({ face, seeds, output: Bit.Inputs.OCCT.voronoiCells2dOutputEnum.edges });
    • Beta

      Places seeds in a solid: at random, on a jittered grid, or evenly spaced by Poisson sampling, whose spacing affectors can grade; then evens them out by relax rounds.

      The same seed gives the same seeds, so a design stays put between runs.

      Parameters

      Returns Promise<Bit.Inputs.Base.Point3[]>

      The seeds, inside the solid

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 40, length: 40, height: 40, center: [0, 0, 0] });
      const seeds = await bitbybit.occt.patterns.voronoi.seeds3d({ shape: box, method: Bit.Inputs.OCCT.voronoiSeedMethodEnum.grid, spacing: 8, jitter: 0.4 });
      const cells = await bitbybit.occt.patterns.voronoi.cells3d({ shape: box, seeds });