Bitbybit Docs
    Preparing search index...

    Class MeshEvaluate

    Reading Manifold mesh data: the position and extra properties of a vertex, the vertices of a triangle, the tangent of a half-edge, the transform of a triangle run, and the counts of properties, vertices, triangles and runs. Indexes count from 0.

    Index

    Constructors

    basic

    • Reads the position of one vertex of a mesh.

      Parameters

      Returns Promise<Point3>

      The vertex position

      const point = await bitbybit.manifold.mesh.evaluate.position({ mesh, vertexIndex: 0 });
      
    • Reads the three vertex indexes of one triangle of a mesh, in counterclockwise order.

      Parameters

      Returns Promise<number[]>

      The three vertex indexes

      const corners = await bitbybit.manifold.mesh.evaluate.verts({ mesh, triangleIndex: 0 });
      
    • Reads the tangent of one half-edge of a smoothed mesh: the direction the surface leaves the edge's start vertex in, as three numbers plus a weight.

      Half-edge three times the triangle index plus j is the edge of triangle t that starts at its j-th vertex; a mesh without smoothing tangents has none.

      Parameters

      Returns Promise<number[]>

      The tangent as [x, y, z, weight]

      const tangent = await bitbybit.manifold.mesh.evaluate.tangent({ mesh: smoothedMesh, halfEdgeIndex: 0 });
      
    • Reads the properties of one vertex beyond its position, such as normals or colors stored in extra channels.

      Parameters

      Returns Promise<number[]>

      The extra property values, in channel order

      const props = await bitbybit.manifold.mesh.evaluate.extras({ mesh, vertexIndex: 0 });
      
    • Reads the column-major 4x4 matrix that carries the original mesh onto one run of triangles, the placement of that instance.

      Parameters

      Returns Promise<number[]>

      The 16 numbers of the matrix

      const placement = await bitbybit.manifold.mesh.evaluate.transform({ mesh, triangleRunIndex: 0 });
      
    • Tells whether one run of triangles faces the other way than the original mesh it came from, as the inner surface left by a subtraction does. Informational: the normals a mesh hands out are already oriented for the result.

      Parameters

      Returns Promise<boolean>

      True when the run is a backside

      const flipped = await bitbybit.manifold.mesh.evaluate.backside({ mesh, triangleRunIndex: 0 });
      
    • Tells whether the first three extra property channels of one run of triangles hold vertex normals, which manifold.operations.calculateNormals writes there.

      Parameters

      Returns Promise<boolean>

      True when the run carries normals in its properties

      const lit = await bitbybit.manifold.mesh.evaluate.hasNormals({ mesh, triangleRunIndex: 0 });
      
    • Counts the property channels each vertex of a mesh carries; the position alone takes three.

      Parameters

      Returns Promise<number>

      The number of properties per vertex

      const channels = await bitbybit.manifold.mesh.evaluate.numProp({ mesh });
      
    • Counts the property vertices of a mesh, which can exceed the geometric vertices where neighboring triangles carry different properties.

      Parameters

      Returns Promise<number>

      The number of vertices

      const vertices = await bitbybit.manifold.mesh.evaluate.numVert({ mesh });
      
    • Counts the triangles of a mesh, which together make its whole surface.

      Parameters

      Returns Promise<number>

      The number of triangles

      const triangles = await bitbybit.manifold.mesh.evaluate.numTri({ mesh });
      
    • Counts the triangle runs of a mesh: each run is a stretch of consecutive triangles that came from the same instance of the same input shape.

      Parameters

      Returns Promise<number>

      The number of runs

      const runs = await bitbybit.manifold.mesh.evaluate.numRun({ mesh });