Bitbybit Docs
    Preparing search index...

    Class ManifoldTransforms

    Moving, turning, scaling, mirroring and warping Manifold solids. The kernel combines transforms lazily, so chaining them is cheap; angles are in degrees, and rotations turn about the origin, X first, then Y, then Z. Every method returns a new solid.

    Index

    Constructors

    matrix

    • Applies a 4x4 matrix to a solid.

      The matrix is column-major, 16 numbers with the translation at indexes 12 to 14; the kernel reads it as a 3x4 affine transform and ignores the last row.

      Parameters

      Returns Promise<ManifoldPointer>

      The transformed solid

      const moved = await bitbybit.manifold.manifold.transforms.transform({ manifold: cube, transform: matrix });
      
    • Applies a list of 4x4 matrices to a solid one after another, first to last, and returns the final result.

      An empty list throws an error.

      Parameters

      Returns Promise<ManifoldPointer>

      The solid after all the matrices

      const placed = await bitbybit.manifold.manifold.transforms.transforms({ manifold: cube, transforms: [turn, move] });
      

    multiple

    • Makes one moved copy of a solid per vector, for laying out repeats.

      Parameters

      Returns Promise<ManifoldPointer[]>

      One moved copy per vector, in the same order

      const row = await bitbybit.manifold.manifold.transforms.translateByVectors({ manifold: cube, vectors: [[0, 0, 0], [10, 0, 0], [20, 0, 0]] });
      

    transforms

    • Rotates a solid about the origin by separate angles in degrees about X, then Y, then Z.

      Multiples of 90 degrees are exact, with no rounding error.

      Parameters

      Returns Promise<ManifoldPointer>

      The rotated solid

      const turned = await bitbybit.manifold.manifold.transforms.rotateXYZ({ manifold: cube, x: 0, y: 0, z: 45 });
      
    • Moves every vertex of a solid with a function of your own that changes the vertex position in place, for bends, tapers and other free deformations.

      The mesh connectivity stays the same and nothing checks that the result still makes sense, so a function that folds the surface through itself gives a broken solid.

      Parameters

      Returns Promise<ManifoldPointer>

      The warped solid

      const bent = await bitbybit.manifold.manifold.transforms.warp({
      manifold: cube,
      warpFunc: (vert) => { vert[0] += vert[2] * 0.2; },
      });