AgentStack
SKILL verified MIT Self-run

Mesh Processing

skill-amanbh997-claude-skills-for-computational-designers-mesh-processing · by Amanbh997

Mesh data structures, mesh operations, mesh analysis, mesh repair, UV mapping and unfolding, quad meshing, mesh-to-NURBS conversion, and mesh quality assessment for AEC computational design

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add skill-amanbh997-claude-skills-for-computational-designers-mesh-processing

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Mesh Processing? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Mesh Processing

This skill provides comprehensive guidance on mesh processing for architecture, engineering, and construction. Meshes are the workhorse representation for simulation (FEA, CFD, acoustics), fabrication (3D printing, CNC), visualization (rendering, VR/AR), and increasingly for design geometry itself. This reference covers data structures, operations, analysis, repair, UV mapping, quad meshing, and reverse engineering.


1. Mesh Processing in AEC

1.1 Why Meshes Matter

Meshes represent 3D geometry as collections of vertices, edges, and faces. In AEC:

  • Simulation: Finite Element Analysis (structural), Computational Fluid Dynamics (wind/airflow), thermal simulation, acoustic simulation, and daylight simulation all require mesh discretization of geometry. The mesh quality directly determines simulation accuracy.
  • Visualization: Real-time rendering (game engines, VR/AR) operates on triangulated meshes. Level-of-detail mesh decimation controls rendering performance.
  • Fabrication: 3D printing requires watertight triangulated meshes (STL/3MF). CNC milling requires surface meshes for toolpath generation. Robotic fabrication uses mesh representations for collision checking and path planning.
  • Scanning: LiDAR, photogrammetry, and structured light scanning produce point clouds that are reconstructed into meshes. Scan-to-BIM workflows begin with mesh processing.
  • Design: Freeform architectural surfaces (shells, facades, roofs) are often designed as meshes, particularly when the target is a panelized or discrete structure.

1.2 Mesh vs. NURBS Trade-offs

| Dimension | Mesh | NURBS | |---|---|---| | Representation | Discrete vertices + faces | Continuous parametric surface | | Precision | Approximate (chord tolerance) | Mathematically exact | | Topology | Arbitrary (any connectivity) | Rectangular patch structure | | Boolean operations | Robust (with good libraries) | Fragile (trimmed surface issues) | | Simulation compatibility | Direct (FEA/CFD mesh = geometry mesh) | Requires meshing step | | File size (complex forms) | Smaller (for tessellated freeform) | Larger (many control points) | | Editing | Vertex-level sculpting, subdivision | Control point manipulation, continuity | | Rendering | Direct (GPU operates on triangles) | Requires tessellation | | Fabrication (3D print) | Direct (STL is triangulated mesh) | Requires tessellation | | Industry standard | Visualization, gaming, scanning | CAD, BIM, manufacturing |

When to use meshes in AEC:

  • Freeform geometry that resists NURBS patch layout (organic shapes, scanned surfaces)
  • Direct-to-simulation workflows (structural shells, CFD domains)
  • Fabrication output (3D printing, panelization)
  • Processing scan data (point cloud to mesh to BIM)
  • Real-time visualization and VR/AR content

When to use NURBS:

  • Precise geometric control with continuity constraints (G0/G1/G2)
  • Standard architectural elements (planar walls, cylindrical columns, ruled surfaces)
  • BIM integration (Revit, ArchiCAD expect NURBS/solid geometry)
  • Manufacturing with CNC that expects parametric surfaces

1.3 The Mesh Processing Pipeline

[Input Geometry]
    |
    v
[Mesh Generation] -- from NURBS, from point cloud, from implicit, from scratch
    |
    v
[Mesh Repair] -- fix non-manifold, fill holes, remove degenerates, orient normals
    |
    v
[Mesh Operations] -- subdivide, remesh, decimate, smooth, boolean, offset
    |
    v
[Mesh Analysis] -- curvature, thickness, quality metrics, topology check
    |
    v
[Mesh Optimization] -- improve quality for target application (FEA, printing, rendering)
    |
    v
[Output]
    |-- Simulation mesh (FEA/CFD solver format)
    |-- Fabrication mesh (STL/3MF for 3D printing, unfolded for sheet fabrication)
    |-- Visualization mesh (glTF/FBX for rendering, LOD variants)
    |-- Reverse-engineered NURBS (mesh-to-NURBS conversion for CAD)

2. Mesh Data Structures

2.1 Vertex-Face List (Simple Mesh)

The simplest representation. Two arrays:

  • Vertices: List of 3D coordinates. V = [(x0,y0,z0), (x1,y1,z1), ..., (xn,yn,zn)]
  • Faces: List of vertex index tuples. F = [(v0,v1,v2), (v0,v2,v3), ...] for triangles, or [(v0,v1,v2,v3), ...] for quads.

Memory: 3 floats per vertex (12 bytes as float32, 24 bytes as float64) + 3 or 4 ints per face (12 or 16 bytes as int32).

Advantages: Simple, compact, easy to serialize (STL, OBJ, PLY formats use this structure). Direct GPU upload.

Limitations: No explicit edge representation. Adjacency queries are O(F) where F = number of faces. Finding neighboring faces of a face requires scanning all faces. Finding all faces incident on a vertex requires scanning all faces.

Use: File I/O, GPU rendering, simple geometry storage. Not suitable for topological operations.

2.2 Half-Edge Data Structure

The standard data structure for mesh processing algorithms. Each undirected edge is represented as two directed half-edges pointing in opposite directions.

Components:

  • Vertex: Stores position (x,y,z) and pointer to one outgoing half-edge.
  • Face: Stores pointer to one bounding half-edge.
  • Half-edge: Stores pointers to:
  • next: Next half-edge around the same face (counter-clockwise).
  • prev: Previous half-edge around the same face (or computed from next).
  • twin (or opposite): The half-edge on the adjacent face sharing the same edge but pointing in the opposite direction.
  • vertex: The vertex this half-edge points to (its target vertex).
  • face: The face this half-edge bounds.

Key traversal operations (all O(1)):

  • Adjacent face across an edge: halfedge.twin.face
  • Next vertex around a face: halfedge.next.vertex
  • All faces around a vertex: Follow halfedge.twin.next repeatedly until returning to start.
  • All vertices adjacent to a vertex: Same traversal, collecting vertex pointers.
  • Is edge on boundary?: halfedge.twin == null (boundary half-edges have no twin, or twin points to a null/boundary face).

Memory: Each half-edge stores 5 pointers (next, prev, twin, vertex, face). Each vertex stores 1 pointer. Each face stores 1 pointer. For a mesh with V vertices, E edges, and F faces: 2E half-edges 5 pointers + V 1 pointer + F * 1 pointer. Roughly 10E + V + F pointers.

Implementations:

  • C++: OpenMesh, CGAL Surface_mesh, libigl (uses different internal structure but exposes half-edge interface)
  • Python: trimesh (uses face adjacency internally, not true half-edge), OpenMesh Python bindings, pmp-library
  • C#: Plankton (Grasshopper plugin, true half-edge), RhinoCommon Mesh (vertex-face list, not half-edge)

2.3 Winged-Edge Data Structure

Predecessor to half-edge. Each edge stores pointers to:

  • Two vertices (endpoints)
  • Two faces (left and right)
  • Four edges (next and previous on each face)

More complex to traverse than half-edge. Largely superseded by half-edge in modern implementations but historically important.

2.4 Corner Table

Compact representation for triangle meshes. Each triangle has 3 corners (one per vertex). Each corner stores:

  • Vertex index
  • Opposite corner index (the corner across the shared edge in the adjacent triangle)

Memory: 2 integers per corner = 6 integers per triangle. Very compact.

Advantages: Cache-friendly, suitable for GPU processing. Jarek Rossignac's corner table enables efficient traversal with minimal storage.

Limitations: Triangle meshes only (no quads or n-gons).

2.5 Data Structure Comparison

| Operation | Vertex-Face List | Half-Edge | Winged-Edge | Corner Table | |---|---|---|---|---| | Adjacent faces of face | O(F) | O(1) | O(1) | O(1) | | Adjacent vertices of vertex | O(F) | O(valence) | O(valence) | O(valence) | | Faces around vertex | O(F) | O(valence) | O(valence) | O(valence) | | Boundary detection | O(E) | O(1) per edge | O(1) per edge | O(1) per corner | | Edge collapse | Difficult | O(valence) | O(valence) | O(valence) | | Face insertion | O(1) | O(1) | O(1) | O(1) | | Memory per triangle | Low | Medium--High | High | Low | | Implementation complexity | Simple | Medium | High | Medium | | Quad/n-gon support | Yes | Yes | Yes | No (tri only) |


3. Mesh Operations Catalog

3.1 Subdivision

Subdivision increases mesh resolution by splitting faces and repositioning vertices to approach a smooth limit surface.

Catmull-Clark Subdivision
  • Input: Quad mesh (or mixed, but quad-dominant preferred)
  • Algorithm: (1) Face points: centroid of each face. (2) Edge points: average of edge midpoint and adjacent face points. (3) Vertex points: weighted average of original vertex, adjacent face points, and adjacent edge midpoints. (4) Connect face points to edge points and vertex points to form new quads.
  • Properties: Limit surface is C2 continuous everywhere except at extraordinary vertices (valence != 4), where it is C1. All faces become quads after one iteration.
  • Parameters: Number of iterations (1--4 typical).
  • Use: Smooth freeform surfaces, furniture design, organic shapes, rendering subdivision surfaces.
Loop Subdivision
  • Input: Triangle mesh only
  • Algorithm: (1) Edge points: weighted average of edge endpoints and opposite vertices. (2) Vertex points: weighted average of original vertex and neighbors. (3) Each triangle splits into 4 triangles.
  • Properties: Limit surface is C2 except at extraordinary vertices (valence != 6), where it is C1. Output is always triangles.
  • Use: Triangle mesh smoothing, FEA mesh refinement (with care).
Doo-Sabin Subdivision
  • Input: Any mesh (quad, tri, mixed)
  • Algorithm: Face-based. New vertices at weighted positions within each face. New faces formed from corner cutting. Dual-like operation.
  • Properties: Limit surface is C1 everywhere. Produces mostly quad faces.
  • Use: Less common. Rounded, bevel-like effect.
Sqrt(3) Subdivision
  • Input: Triangle mesh
  • Algorithm: Insert vertex at face centroid. Connect to face vertices. Flip original edges. Each triangle becomes 3 triangles.
  • Properties: Slower refinement rate than Loop (sqrt(3) increase per iteration vs. 4x). Produces more uniform triangle sizes.
  • Use: When gradual refinement is needed.
Mid-Edge Subdivision
  • Input: Quad mesh
  • Algorithm: Insert vertices at edge midpoints. Connect to form new quads. Simplest quad subdivision.
  • Properties: No smoothing -- just refines topology. Use with separate smoothing step for controlled results.

3.2 Decimation

Reduce face count while preserving shape as much as possible.

Vertex Decimation

Remove vertices and retriangulate the resulting hole. Simple but poor quality control.

Edge Collapse (QEM -- Quadric Error Metric)
  • Algorithm: (1) For each vertex, compute a 4x4 quadric matrix Q representing the sum of squared distances to incident face planes. (2) For each edge, compute the optimal merged vertex position that minimizes the quadric error and the error value. (3) Collapse the edge with the smallest error. (4) Update quadric matrices for affected vertices. (5) Repeat until target face count reached.
  • Quality: Excellent shape preservation. The gold standard for mesh decimation.
  • Parameters: Target face count or target error threshold.
  • Boundary preservation: Weight boundary edges higher to prevent boundary deformation.
  • Implementation: trimesh (simplify_quadric_decimation), MeshLab (Quadric Edge Collapse Decimation), Open3D (simplify_quadric_decimation).
Face Clustering

Group adjacent faces into clusters. Replace each cluster with a single face. Fast but lower quality than QEM.

3.3 Remeshing

Improve mesh quality without changing shape significantly.

Isotropic Remeshing
  • Goal: Uniform triangle sizes. All edges approximately equal length.
  • Algorithm: Iterative process: (1) Split long edges (> 4/3 * target length). (2) Collapse short edges ( 0, mu lambda.
  • Parameters: Lambda (0.3--0.5), mu (-0.31 to -0.53), iterations (5--50). Typical: lambda=0.5, mu=-0.53.
  • Advantage: Preserves volume. The negative mu step inflates the mesh to compensate for the positive lambda step's shrinkage.
  • Use: Scan data noise reduction where volume accuracy matters.
HC Laplacian Smoothing
  • Algorithm: Modified Laplacian that preserves volume by tracking the original vertex positions and biasing the smoothed positions back toward them.
  • Advantage: Better volume preservation than Taubin with similar smoothing quality.
Bilateral Smoothing
  • Algorithm: Adapts bilateral filter from image processing. Smooths along the surface but preserves sharp features (edges, creases) by weighting neighbors by both spatial proximity and normal similarity.
  • Advantage: Preserves sharp edges while smoothing flat areas. Ideal for architectural meshes with intended creases.
  • Parameters: Spatial sigma (smoothing radius), normal sigma (feature sensitivity), iterations.

3.5 Boolean Operations

Combine meshes using set operations.

Union (A + B)

Result contains all volume inside A or B. Merging two building volumes.

Difference (A - B)

Result contains volume inside A but not inside B. Cutting a courtyard out of a building mass.

Intersection (A ∩ B)

Result contains volume inside both A and B. Finding the overlap between two building footprints.

Robustness issues: Mesh booleans are notoriously fragile. Common failures:

  • Coincident faces (faces from A and B are coplanar): causes ambiguous inside/outside classification.
  • Near-miss intersections: numerical precision issues when intersection curves pass very close to existing vertices/edges.
  • Non-manifold input: meshes with holes, self-intersections, or non-manifold topology cause boolean failure.

Solutions:

  • Use exact arithmetic libraries (CGAL, libigl with exact predicates).
  • Pre-process: repair meshes, remove degenerates, slightly perturb coincident geometry.
  • Cork library: specifically designed for robust mesh booleans.
  • Manifold library (Emmett Lalish): guaranteed-correct mesh booleans using halfedge structure.

Implementation:

  • Python: trimesh (boolean via Blender/manifold3d), PyMeshLab, libigl
  • C++: CGAL Nef_polyhedron, libigl boolean, Cork, Manifold
  • Grasshopper: Mesh Boolean components (Rhino 7+), Cockatoo, Dendro (volume-based)
  • Rhino: MeshBooleanUnion, MeshBooleanDifference, MeshBooleanIntersection commands

3.6 Offset

Create a thickened or shell version of a mesh.

Vertex-Normal Offset
  • Method: Move each vertex along its vertex normal by offset distance.
  • Problem: Self-intersections at concave regions (normals converge inward). Gaps at convex regions (normals diverge outward).
  • Mitigation: Post-process with self-intersection removal. Or use variable offset distance based on local curvature.
Minkowski Sum Offset
  • Method: Convolve the mesh with a small sphere. Mathematically correct but computationally expensive.
  • Implementation: CGAL Minkowskisum3.
Implicit Offset
  • Method: Convert mesh to signed distance field (SDF). Offset by adjusting the iso-surface level. Extract the new mesh from the modified SDF.
  • Advantage: No self-intersections. Works on complex geometry.
  • Implementation: OpenVDB (voxel-based SDF), Dendro (Grasshopper plugin wrapping OpenVDB).
Shell/Thickening for 3D Printing
  • Method: Create inner offset surface (vertex-normal offset inward), close the boundary edges between inner and outer surfaces, creating a hollow shell.
  • Parameters: Wall thickness (minimum depends on material: 1mm for SLA resin, 2mm for FDM PLA, 3mm for SLS nylon).

3.7 Other Operations

Weld/Unweld Vertices
  • Weld: Merge vertices within a tolerance distance. Reduces vertex count and creates shared edges. Essential after importing meshes with duplicate vertices.
  • Unweld: Split sha

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.