Skip to engineering

Is this mesh a closed, consistent surface?

A surface can look finished on screen and still have a hole or a face turned the wrong way. This workbench builds a torus or a sphere as an indexed mesh, counts how its edges and faces connect, and lets you remove or reverse one face to see which checks catch it.

A ring torus as the mesh the lab builds and checks, and below it the same mesh laid flat with every triangle at its true area. The pigment marks the two bands that make it a torus, one round the tube and one round the hole.

The mesh workbench

The shapes come from the numbers you type. Everything is calculated in your browser, and nothing is sent anywhere or connected to a machine.

Mesh parameters

R measures from the axis to the tube centre. All radii: 0.1 to 1,000 mm. Ring torus requires R > r.

Around axis: 8 to 128. Section: 4 to 96. Section means a full tube circle for the torus, or north-to-south latitude intervals for the sphere. At most 24,576 triangles.

Generate to see the available face IDs. Each fault applies to a freshly built mesh.

Orthographic inspection

Awaiting geometry
The mesh projection requires JavaScript and canvas support. Numerical diagnostics are also provided as text.
Gold: mesh edges. Orange: boundary. Pink: winding or nonmanifold edge. Dashed orange: removed face outline.
Inspection controls

Use Tab to reach each control, then arrow keys to rotate or zoom. No drag gesture is required. Solid mode draws depth-sorted triangles, an approximation of hidden-surface removal, and diagnostic edges stay visible through the surface.

The workbench needs JavaScript. The method below is always available.

STL requires all implemented checks to pass. JSON also exports failed diagnoses with the exact indexed mesh. Any parameter edit disables both until regeneration. STL coordinates are intended as mm, but STL itself is unitless.

Replay a validation file

Paste a validation JSON downloaded from this page. The workbench rebuilds the mesh from the file's parameters and fault, runs every check and measurement again, and lists any value that differs.

Up to 8,000,000 characters. Numbers must agree to one part in a billion of the recomputed value, or within 1e-12 for values that close to zero; every other value must match exactly. Editing the text clears the last replay.

Method and limits

01 Build a shared topology

The ring torus samples x = (R + r cos v) cos u, y = (R + r cos v) sin u, z = r sin v. The sphere samples latitude and longitude, with one shared vertex at each pole. Periodic seams share indices as well as coordinates. Each quadrilateral becomes two outward-oriented triangles.

02 Count the connections

Every undirected edge stores its incident faces and traversal directions. One incident face means boundary; more than two means a nonmanifold edge. Two faces must traverse their shared edge in opposite directions. Vertex links must form a single cycle or path. Duplicate indexed faces, disconnected components, unused vertices and invalid indices are also checked.

03 Measure the triangles

Area is the sum of half the cross-product magnitude. Signed volume is the compensated sum of a · (b × c) / 6 for each oriented triangle, with coordinates relative to the bounding-box center to reduce cancellation. Zero or near-zero cross products flag degeneracy at 10-12 times squared bounding-box extent. Positive volume must exceed 10-12 times cubed extent. On an open or inconsistently wound mesh the signed sum depends on the reference point and stops measuring a volume.

The report also gives the axis-aligned bounding box of the vertices, the area-weighted centroid of the triangles and, for a closed outward surface, the centroid of the enclosed solid from the same signed tetrahedra. For these centred shapes the analytic box is ±r on every axis for the sphere and ±(R + r), ±(R + r), ±r for the torus, and both centroids sit at the origin. The resolution ladder rebuilds the intact surface at 8 × 4, 16 × 8, 32 × 16, 64 × 32 and 128 × 64 segments and at the selected resolution; each doubling cuts both errors by about four, the mark of second-order faceting error.

04 Break one face on purpose

Removing one triangle from these meshes produces three boundary edges and reduces Euler characteristic by one. Reversing one triangle preserves V, E, F and area, but introduces three winding conflicts. Three more faults reach the other checks. Duplicating a triangle gives three edges a third face and raises χ by one. Splitting one corner into a coincident copy opens four boundary edges and lowers χ by one, though no coordinate moves. Collapsing a triangle onto two of its corners leaves a zero-area face and three boundary edges. Only an intact mesh exports STL. A faulted one can still export the diagnostic JSON, and the replay panel rebuilds that file from its parameters and fault to confirm every value.

Exact values for comparison

Sphere
χ = 2; volume = 4πr³ / 3; area = 4πr².
Ring torus
χ = 0; volume = 2π²Rr²; area = 4π²Rr.

χ = V - E + F uses referenced vertices and index-valid, distinct-vertex triangles. With invalid or duplicate triangles the count is a diagnostic only. Finer resolution reduces faceting error for the intact generators. The volume difference compares the facets with the exact shape.