Tools for agents: Exact triangle plane clipping

Clip a 3D triangle to a closed half-space and return exact polygon vertices with a winding-preserving triangulation.

Connect with MCP

{
  "mcpServers": {
    "super-agent-tools": {
      "url": "https://app.getsupers.com/sites/agent-triangle-clip/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 clip_triangle_to_plane

Retains points satisfying dot(plane_normal,point-plane_point)>=0, including the cutting plane. Reverse the normal to retain the opposite side. Coordinates are integers or quoted finite decimal/fraction strings; JSON floats and booleans fail. The normal need not be unit length but must be nonzero; the input triangle must be noncollinear. Output coordinates are reduced rational strings. Output vertices follow the original boundary winding, with adjacent duplicates removed; faces are zero-based fan triangles into that vertex list. A cut can produce an empty result, one boundary point, a boundary segment, the original triangle or a quadrilateral. dimension is null, 0, 1 or 2 respectively; point and segment results have no faces. Entirely coplanar triangles are fully retained. input_plane_values are unnormalized signed dot products, not Euclidean distances. boundary_vertex_indices identify exact plane membership without tolerance. This clips one triangle against one plane, creates no closed-mesh cap, and does not interpolate UVs or other attributes.

Input and output schemas
{
  "name": "clip_triangle_to_plane",
  "title": "Exact triangle plane clipping",
  "description": "Clip a triangle to dot(plane_normal, point-plane_point)>=0 with exact rational arithmetic, preserving winding.",
  "inputSchema": {
    "properties": {
      "triangle": {
        "maxItems": 3,
        "minItems": 3,
        "prefixItems": [
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          },
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          },
          {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            ],
            "type": "array"
          }
        ],
        "title": "Triangle",
        "type": "array"
      },
      "plane_point": {
        "maxItems": 3,
        "minItems": 3,
        "prefixItems": [
          {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          }
        ],
        "title": "Plane Point",
        "type": "array"
      },
      "plane_normal": {
        "maxItems": 3,
        "minItems": 3,
        "prefixItems": [
          {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          }
        ],
        "title": "Plane Normal",
        "type": "array"
      }
    },
    "required": [
      "triangle",
      "plane_point",
      "plane_normal"
    ],
    "title": "clip_triangle_to_planeArguments",
    "type": "object"
  },
  "outputSchema": {
    "additionalProperties": true,
    "title": "clip_triangle_to_planeDictOutput",
    "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-triangle-clip/call
Content-Type: application/json

{
  "triangle": [
    [
      -1,
      0,
      0
    ],
    [
      2,
      0,
      0
    ],
    [
      2,
      3,
      0
    ]
  ],
  "plane_point": [
    0,
    0,
    0
  ],
  "plane_normal": [
    1,
    0,
    0
  ]
}

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.

An exact plane cut preserves the retained boundary

Read the explanation

The documented triangle has vertices negative one zero zero, two zero zero and two three zero. A plane through the origin with normal one zero zero retains x greater than or equal to zero. As the illustrated boundary moves from negative one toward zero, each crossing stays on its triangle edge. At the final plane, the lower edge crosses at zero zero zero and the sloped edge at zero one zero. The retained boundary is a quadrilateral. This is an exact worked contract example; the offline preview does not call the remote clipping implementation. The input triangle area is nine halves. The removed small triangle has base one and height one, so its area is one half. Retained area is four square units. The boundary vertices can follow the original winding as zero zero, two zero, two three, zero one, with z zero throughout. A fan triangulation uses two faces and preserves that winding. Exact boundary membership is recorded without a tolerance. The normal need not be unit length. Doubling its positive scale keeps the half-space and cut geometry while doubling signed plane values. Those values are not Euclidean distances. Coordinates must be integers or quoted finite decimal or fraction strings; JSON floats and booleans are rejected. A coplanar triangle is retained. Point or segment results have no faces. This operation adds no closed-mesh cap and interpolates no extra attributes.

Exact Sutherland-Hodgman Triangle Plane Clipping

How does the tool clip a single 3D triangle against a half-space plane without floating-point precision loss?

The endpoint executes a rational Sutherland-Hodgman clipping pass across the three oriented edges of an input triangle. Every coordinate is converted to Python fractions, avoiding IEEE 754 floating-point drift. For each vertex, the signed dot product dot(plane_normal, point - plane_point) determines whether the point lies inside the retained half-space (dot >= 0) or outside (dot < 0). When an edge crosses the plane boundary, the exact intersection parameter t = d0 / (d0 - d1) is solved using rational arithmetic to place a new vertex on the clipping plane, returning winding-preserving vertices and fan-triangulated faces.

This tool clips a single independent triangle against one half-space plane; it does not perform manifold mesh clipping, seal closed solids with interior caps, or interpolate UV coordinates, vertex colors, or normals. Inputs must be non-collinear and use integer or finite decimal/fraction strings rather than JSON floating-point numbers.

Try a worked example

Submit the default form with triangle [[-1,0,0], [2,0,0], [2,3,0]], plane_point [0,0,0], and plane_normal [1,0,0]. The tool evaluates dot products [-1, 2, 2] for the vertices. Vertex 0 is outside (d < 0) while vertices 1 and 2 are inside (d >= 0). Edge 0->1 crosses the plane at t = -1/(-1-2) = 1/3, yielding boundary point [0,0,0], and edge 2->0 crosses back at t = 2/(2-(-1)) = 2/3, yielding boundary point [0,1,0]. The resulting 4-vertex polygon [[0,0,0], [2,0,0], [2,3,0], [0,1,0]] is decomposed into two fan triangles with faces [[0,1,2], [0,2,3]].

Signed Half-Space Classification

For each vertex p, the unnormalized distance metric d = dot(plane_normal, p - plane_point) classifies the point. If d >= 0, the point belongs to the retained closed half-space. If all d >= 0, the input triangle is retained unchanged without splitting. If all d < 0, an empty vertex list and null dimension are returned.

Exact Edge Splitting & Fan Triangulation

When consecutive vertices have opposite half-space signs ((d0 >= 0) != (d1 >= 0)), the edge segment is split at parameter t = d0 / (d0 - d1), computing the intersection point a + t * (b - a) purely in reduced fractions. Output vertices preserve the original perimeter winding order. Polygons with 4 vertices are fan-triangulated into two triangles indexed as [0, i, i + 1].