Tools for agents: Triangle mesh surface measurements

Measure triangle areas, oriented unit normals and the area-weighted centroid of an indexed mesh surface.

Connect with MCP

{
  "mcpServers": {
    "super-agent-tools": {
      "url": "https://app.getsupers.com/sites/agent-mesh-surface/mcp"
    }
  }
}
Streamable HTTP · No API key · Stateless

Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.

Call measure_mesh_surface

Vertices use finite JSON numbers; faces contain three zero-based integer indices. Areas use squared input units and centroids use input units. The total counts every supplied triangle once: overlaps and duplicate faces count repeatedly, and no union or manifold repair is performed. Reversing winding reverses a nondegenerate normal but preserves area and centroid. A triangle centroid is the arithmetic mean of its vertices; the surface centroid weights those centroids by area. Empty or entirely degenerate surfaces have zero area and null surface_centroid. Zero-area faces have null unit_normal and are reported in degenerate_faces. Floating-point arithmetic is approximate, with no geometric tolerance; underflow may classify extremely small faces as degenerate. Nonfinite inputs, invalid indices and nonfinite computed results fail the whole call. Rescale extreme coordinates before use. This measures surface area, not solid volume, mass or a volume centroid. Open meshes and disconnected triangle soups are accepted.

Input and output schemas
{
  "name": "measure_mesh_surface",
  "title": "Triangle mesh surface measurements",
  "description": "Measure each triangle and total area with an area-weighted surface centroid; reject invalid indices and nonfinite arithmetic.",
  "inputSchema": {
    "properties": {
      "vertices": {
        "items": {
          "maxItems": 3,
          "minItems": 3,
          "prefixItems": [
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "integer"
                }
              ]
            },
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "integer"
                }
              ]
            },
            {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "integer"
                }
              ]
            }
          ],
          "type": "array"
        },
        "title": "Vertices",
        "type": "array"
      },
      "faces": {
        "items": {
          "maxItems": 3,
          "minItems": 3,
          "prefixItems": [
            {
              "type": "integer"
            },
            {
              "type": "integer"
            },
            {
              "type": "integer"
            }
          ],
          "type": "array"
        },
        "title": "Faces",
        "type": "array"
      }
    },
    "required": [
      "vertices",
      "faces"
    ],
    "title": "measure_mesh_surfaceArguments",
    "type": "object"
  },
  "outputSchema": {
    "additionalProperties": true,
    "title": "measure_mesh_surfaceDictOutput",
    "type": "object"
  },
  "icons": null,
  "annotations": {
    "title": null,
    "readOnlyHint": true,
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": false
  },
  "meta": null,
  "execution": null
}

Run the example to see the actual result.

HTTP alternative

POST https://app.getsupers.com/sites/agent-mesh-surface/call
Content-Type: application/json

{
  "vertices": [
    [
      0,
      0,
      0
    ],
    [
      4,
      0,
      0
    ],
    [
      0,
      3,
      0
    ],
    [
      0,
      0,
      2
    ]
  ],
  "faces": [
    [
      0,
      1,
      2
    ],
    [
      0,
      1,
      3
    ]
  ]
}

The HTTP and MCP interfaces execute the same implementation. Validation errors are returned explicitly. See the tool notes above for its supported inputs and behavior.

Triangle areas and an area-weighted surface center

Read the explanation

The documented example has vertices at the origin, four along x, three along y, and two along z. Its first triangle spans x and y, so its area is half of four times three, or six. The second spans x and z, with area half of four times two, or four. At thirty pixels per square coordinate unit the bars span one hundred eighty and one hundred twenty. Together they total ten. This explains the supplied geometry. The offline page has no loaded shared app script, so argument editing works but no HTTP or MCP computation is demonstrated or requested. A triangle center is the average of its three vertices. The two face centers are four thirds, one, zero and four thirds, zero, two thirds. Weighting them by areas six and four, then dividing by ten, yields surface center x four thirds, y point six, z four fifteenths. At three hundred pixels per center coordinate the y and z bars span one hundred eighty and eighty. Equal face weighting would instead give y one half and z one third. This is an area-weighted surface center, not a solid volume center, vertex-average center, or a result returned by an actual local API execution. If all vertex coordinates are scaled by two, the first face area rises from six to twenty four. At ten pixels per square coordinate unit the bars span sixty and two hundred forty. Each edge doubles, so the cross-product magnitude multiplies by four. A unit normal retains its direction under positive uniform scaling. Reversing a face winding reverses its oriented normal without changing area. The original example normal is positive z for the first face and negative y for the second. These are mathematical consequences of the displayed inputs, not independent verification of the production implementation or its validation behavior.

Triangle mesh surface measurements

How does measure_mesh_surface calculate triangle areas, unit normals, and the area-weighted surface centroid from indexed 3D geometry?

The measure_mesh_surface function accepts indexed 3D vertices and triangular face triples to evaluate planar surface geometry. For each triangle face (a, b, c), it constructs edge vectors u = b - a and v = c - a, taking their vector cross product u × v. The magnitude of this cross product is hypot(cross), which equals twice the triangle area. The individual face area is hypot(cross) / 2, and normalizing the cross product vector yields the oriented unit normal (or null if the area is zero). The arithmetic mean of the vertices produces each triangle's centroid, and weighting each triangle centroid by its respective face area over total area yields the overall surface centroid.

This tool calculates surface area and a 2D polygonal boundary surface centroid, not enclosed solid volume or volumetric center of mass (which would require divergence theorem tetrahedral decomposition). It does not perform manifold repair, intersection testing, or duplicate face removal: overlapping faces are counted multiple times. Zero-area or collinear triangles are marked in degenerate_faces and assigned null unit normals without contributing weight to the centroid.

Try a worked example

With the default form arguments containing 4 vertices ([0,0,0], [4,0,0], [0,3,0], [0,0,2]) and 2 faces ([0,1,2] and [0,1,3]), clicking 'Run tool' executes the measurement. Face 0 spans (0,0,0), (4,0,0), and (0,3,0) on the z=0 plane with edge vectors [4,0,0] and [0,3,0]; its cross product is [0, 0, 12], yielding an area of 6.0 and unit normal [0, 0, 1]. Face 1 spans (0,0,0), (4,0,0), and (0,0,2) on the y=0 plane with edge vectors [4,0,0] and [0,0,2]; its cross product is [0, -8, 0], yielding an area of 4.0 and unit normal [0, -1, 0]. The total surface area is 10.0, and the resulting area-weighted surface centroid is [1.3333333333333333, 0.6, 0.26666666666666666].

Cross Product and Triangle Area Formulation

For vertices a, b, and c in 3D Euclidean space, two directed edge vectors sharing vertex a are u = b - a and v = c - a. The cross product u × v produces an orthogonal vector whose Euclidean norm ||u × v|| is equal to the area of the parallelogram spanned by u and v. Half this magnitude, ||u × v|| / 2, gives the exact area of triangle abc.

The unit normal vector is obtained by dividing the cross product vector by ||u × v||. If ||u × v|| is 0, the triangle is collinear or degenerate, in which case the unit normal evaluates to null and the face index is recorded in degenerate_faces.

Area-Weighted Surface Centroid Computation

Each individual triangle centroid c_i is the arithmetic average of its three vertex positions (a + b + c) / 3. The overall surface centroid C is computed by taking the area-weighted sum: C = sum(c_i * area_i) / sum(area_i). If total area is zero or undefined, surface_centroid returns null.