Bitbybit Docs
    Preparing search index...

    Class ManifoldEvaluate

    Measuring Manifold solids and reading their bookkeeping: surface area and volume, vertex, triangle and edge counts, the bounding box, the tolerance, the genus, the gap to another solid, and the id and status the kernel tracks for every solid. Nothing here changes the solid.

    Index

    Constructors

    basic

    • Measures the total surface area of a solid, in square model units.

      Parameters

      Returns Promise<number>

      The surface area

      const area = await bitbybit.manifold.manifold.evaluate.surfaceArea({ manifold: cube });
      
    • Measures the volume of a solid, in cubic model units.

      Parameters

      Returns Promise<number>

      The volume

      const volume = await bitbybit.manifold.manifold.evaluate.volume({ manifold: cube });
      
    • Tells whether a solid has no triangles at all, as the result of an intersection of shapes that do not overlap would.

      Parameters

      Returns Promise<boolean>

      True when the solid is empty

      const empty = await bitbybit.manifold.manifold.evaluate.isEmpty({ manifold: shape });
      
    • Counts the vertices of a solid's mesh, the corners its triangles share.

      Parameters

      Returns Promise<number>

      The number of vertices

      const vertices = await bitbybit.manifold.manifold.evaluate.numVert({ manifold: shape });
      
    • Counts the triangles of a solid's mesh, which is its whole surface.

      Parameters

      Returns Promise<number>

      The number of triangles

      const triangles = await bitbybit.manifold.manifold.evaluate.numTri({ manifold: shape });
      
    • Counts the edges of a solid's mesh, each shared by two triangles.

      Parameters

      Returns Promise<number>

      The number of edges

      const edges = await bitbybit.manifold.manifold.evaluate.numEdge({ manifold: shape });
      
    • Counts the property channels each vertex of a solid carries; the position alone takes three.

      Parameters

      Returns Promise<number>

      The number of properties per vertex

      const channels = await bitbybit.manifold.manifold.evaluate.numProp({ manifold: shape });
      
    • Counts the property vertices of a solid, which is at least numVert: a vertex whose neighboring triangles carry different properties, such as a sharp edge with two normals, is stored more than once.

      Parameters

      Returns Promise<number>

      The number of property vertices

      const propVertices = await bitbybit.manifold.manifold.evaluate.numPropVert({ manifold: shape });
      
    • Finds the axis-aligned box around every vertex of a solid.

      Parameters

      Returns Promise<Vector3[]>

      The minimum corner and the maximum corner

      const [min, max] = await bitbybit.manifold.manifold.evaluate.boundingBox({ manifold: shape });
      
    • Reads the tolerance of a solid, the rounding error that has built up over the transforms and operations that made it.

      Triangles thinner than this are treated as degenerate and removed.

      Parameters

      Returns Promise<number>

      The tolerance in model units

      const tolerance = await bitbybit.manifold.manifold.evaluate.tolerance({ manifold: shape });
      
    • Counts the holes through a solid, the way a ring has one and a sphere none.

      It only makes sense for a single connected piece, so run operations.decompose first on a solid made of several.

      Parameters

      Returns Promise<number>

      The number of holes through the solid

      const holes = await bitbybit.manifold.manifold.evaluate.genus({ manifold: shape });
      
    • Measures the smallest distance between two solids, searching no farther than searchLength.

      The result is between 0 and the search length.

      Parameters

      Returns Promise<number>

      The smallest gap between them

      const gap = await bitbybit.manifold.manifold.evaluate.minGap({ manifold1: cube, manifold2: sphere, searchLength: 100 });
      
    • Reads the id of a solid that is an original, as operations.asOriginal or a freshly built solid makes it; a solid produced from others by an operation reports -1.

      Parameters

      Returns Promise<number>

      The original id, or -1

      const id = await bitbybit.manifold.manifold.evaluate.originalID({ manifold: shape });
      
    • Tells why a solid came out empty: NoError, or a reason such as NotManifold or InvalidConstruction when the mesh it was built from was not a closed surface.

      The status is carried through later operations, so a broken input does not get lost; an empty solid can still report NoError, as intersecting shapes that do not overlap does.

      Parameters

      Returns Promise<string>

      The status name

      const status = await bitbybit.manifold.manifold.evaluate.status({ manifold: shape });
      

    spatial

    • Shoots a ray segment from one point to another and lists every place it crosses the surface of a solid, nearest first; an empty list when it misses.

      A hit carries the point, the normal there, the original face id and its distance along the segment as a fraction of the segment's length.

      Parameters

      Returns Promise<RayHit[]>

      The hits sorted by distance

      const hits = await bitbybit.manifold.manifold.evaluate.rayCast({ manifold: shape, origin: [0, 10, 0], endpoint: [0, -10, 0] });