RepairMesh[mreg]
repairs defects in the mesh region mreg.
RepairMesh[mreg,{def1,…}]
repairs only the specified defects def1,….
RepairMesh
RepairMesh[mreg]
repairs defects in the mesh region mreg.
RepairMesh[mreg,{def1,…}]
repairs only the specified defects def1,….
Details and Options
- RepairMesh repairs defects in mesh-based regions.
- Possible geometrical defects on surface include:
-

"HoleEdges" close holes in the surface 
"TJunctionEdges" remove T junctions 
"TinyFaces" fix faces with near-zero area 
"OverlappingFaces" fix faces that overlap - Possible topological defects include:
-

"IsolatedVertices" remove vertices without incident edges 
"DanglingEdges" remove edges without incident faces 
"SingularEdges" fix edges with more than two incident faces 
"SingularVertices" fix vertices with a non-disc neighborhood 
"TinyComponents" remove tiny connected mesh components 
"FlippedFaces" fix faces that point inward - RepairMesh has the same options as MeshRegion.
Examples
open all close allBasic Examples (1)
Scope (8)
Specification (8)
RepairMesh[\!\(\*Graphics3DBox[«7»]\), "DanglingEdges"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "FlippedFaces"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "HoleEdges"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "IsolatedVertices"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "SingularVertices"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "TinyComponents"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "TinyFaces"]RepairMesh[\!\(\*Graphics3DBox[«7»]\), "TJunctionEdges"]Options (11)
MeshCellHighlight (2)
MeshCellHighlight allows you to specify highlighting for parts of a MeshRegion:
ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, -1 / 2}, {3, 0, 1 / 2}, {4, -1 / 2, 0}, {4, 1 / 2, 0}}, {Point[1], Line[{2, 3}], Triangle[{3, 4, 5}], Tetrahedron[{4, 6, 5, 7}]}];RepairMesh[ℛ, "IsolatedVertices", MeshCellHighlight -> {{1, All} -> Red}]Individual cells can be highlighted using their cell index:
ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, -1 / 2}, {3, 0, 1 / 2}, {4, -1 / 2, 0}, {4, 1 / 2, 0}}, {Point[1], Line[{2, 3}], Triangle[{3, 4, 5}], Tetrahedron[{4, 6, 5, 7}]}];RepairMesh[ℛ, "IsolatedVertices", MeshCellHighlight -> {{1, 1} -> {Thick, Red}, {1, 3} -> {Dashed, Black}}]ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, -1 / 2}, {3, 0, 1 / 2}, {4, -1 / 2, 0}, {4, 1 / 2, 0}}, {Point[1], Line[{2, 3}], Triangle[{3, 4, 5}], Tetrahedron[{4, 6, 5, 7}]}];RepairMesh[ℛ, "IsolatedVertices", MeshCellHighlight -> {Line[{6, 5}] -> {Thick, Red}, Line[{4, 6}] -> {Dashed, Black}}]MeshCellLabel (2)
MeshCellLabel can be used to label parts of a MeshRegion:
ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, -1 / 2}, {3, 0, 1 / 2}, {4, -1 / 2, 0}, {4, 1 / 2, 0}}, {Point[1], Line[{2, 3}], Triangle[{3, 4, 5}], Tetrahedron[{4, 6, 5, 7}]}];RepairMesh[ℛ, "DanglingEdges", MeshCellLabel -> {0 -> "Index"}]Individual cells can be labeled using their cell index:
ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, -1 / 2}, {3, 0, 1 / 2}, {4, -1 / 2, 0}, {4, 1 / 2, 0}}, {Point[1], Line[{2, 3}], Triangle[{3, 4, 5}], Tetrahedron[{4, 6, 5, 7}]}];RepairMesh[ℛ, "DanglingEdges", MeshCellLabel -> {{0, 1} -> "x", {1, 2} -> "y"}]ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, -1 / 2}, {3, 0, 1 / 2}, {4, -1 / 2, 0}, {4, 1 / 2, 0}}, {Point[1], Line[{2, 3}], Triangle[{3, 4, 5}], Tetrahedron[{4, 6, 5, 7}]}];RepairMesh[ℛ, "DanglingEdges", MeshCellLabel -> {Point[{1}] -> "x", Line[{5, 4}] -> "y"}]MeshCellMarker (1)
MeshCellMarker can be used to assign values to parts of a MeshRegion:
ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellMarker -> {{0, 1} -> 1, {0, 2} -> 2, {0, 3} -> 3, {0, 4} -> 4}]Use MeshCellLabel to show the markers:
ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellMarker -> {{0, 1} -> 1, {0, 2} -> 2, {0, 3} -> 3, {0, 4} -> 4}, MeshCellLabel -> {0 -> "Marker"}]MeshCellShapeFunction (2)
MeshCellShapeFunction allows you to specify functions for parts of a MeshRegion:
ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellShapeFunction -> {0 -> (Sphere[#, .1]&)}]Individual cells can be drawn using their cell index:
ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellShapeFunction -> {{0, 1} -> (Sphere[#, .1]&), {0, 2} -> (Sphere[#, .15]&)}]ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellShapeFunction -> {Point[1] -> (Sphere[#, .1]&), Point[2] -> (Sphere[#, .15]&)}]MeshCellStyle (2)
MeshCellStyle allows you to specify functions for parts of a MeshRegion:
ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellStyle -> {{1, All} -> Red, {0, All} -> Black}]Individual cells can be highlighted using their cell index:
ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellStyle -> {{1, 1} -> {Thick, Red}, {1, 2} -> {Dashed, Black}}]ℛ = MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]];RepairMesh[ℛ, "FlippedFaces", MeshCellStyle -> {Line[{3, 2}] -> {Thick, Red}, Line[{2, 1}] -> {Dashed, Black}}]PlotTheme (2)
Use a theme with grid lines and a legend:
RepairMesh[MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]], "FlippedFaces", PlotTheme -> "Detailed"]Use a theme to draw a wireframe:
RepairMesh[MeshRegion[{{1, 0, 0}, {1, 0, 1}, {1, 1, 1}, {0, 0, 1}}, Polygon[{{3, 2, 1}, {4, 3, 2}, {3, 1, 4}, {1, 2, 4}}]], "FlippedFaces", PlotTheme -> "Lines"]Related Guides
Related Workflows
- Make a 3D Printout
History
Text
Wolfram Research (2016), RepairMesh, Wolfram Language function, https://reference.wolfram.com/language/ref/RepairMesh.html.
CMS
Wolfram Language. 2016. "RepairMesh." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RepairMesh.html.
APA
Wolfram Language. (2016). RepairMesh. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RepairMesh.html
BibTeX
@misc{reference.wolfram_2026_repairmesh, author="Wolfram Research", title="{RepairMesh}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/RepairMesh.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_repairmesh, organization={Wolfram Research}, title={RepairMesh}, year={2016}, url={https://reference.wolfram.com/language/ref/RepairMesh.html}, note=[Accessed: 12-June-2026]}