FindMeshDefects[mreg]
finds defects in the mesh region mreg.
FindMeshDefects[mreg,{def1,…}]
finds only the specified type of defects def1, ….
FindMeshDefects[mreg,defects,format]
formats the results according to format specification.
FindMeshDefects
FindMeshDefects[mreg]
finds defects in the mesh region mreg.
FindMeshDefects[mreg,{def1,…}]
finds only the specified type of defects def1, ….
FindMeshDefects[mreg,defects,format]
formats the results according to format specification.
Details and Options
- By default, FindMeshDefects gives a mesh region with defects highlighted.
- Possible geometrical defect types defi on surfaces include:
-

"HoleEdges" edges around a hole in the surface 
"TJunctionEdges" edges that form a T junction 
"TinyFaces" faces with near-zero area 
"OverlappingFaces" faces that overlap - Possible topological defect types defi include:
-

"IsolatedVertices" vertices without incident edges 
"DanglingEdges" edges without incident faces 
"SingularEdges" edges with more than two incident faces 
"SingularVertices" vertices with a non-disc neighborhood 
"TinyComponents" tiny connected mesh components 
"FlippedFaces" faces that point inward - Possible format specifications include:
-
Automatic mesh region with defects highlighted "Cell" association with mesh cells for each defect type "CellIndex" association with mesh cell indexes for each defect type - FindMeshDefects takes a PlotLegends option as well the options of MeshRegion.
- With the setting PlotLegendsAutomatic, a legend is produced for each type of defect.
Examples
open all close allBasic Examples (1)
Scope (10)
Specification (10)
FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "DanglingEdges"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "FlippedFaces"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "HoleEdges"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "IsolatedVertices"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "OverlappingFaces"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "SingularEdges"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "SingularVertices"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "TinyComponents"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "TinyFaces"]FindMeshDefects[\!\(\*Graphics3DBox[«7»]\), "TJunctionEdges"]Options (14)
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}]}];FindMeshDefects[ℛ, "SingularEdges", MeshCellHighlight -> {{0, 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}]}];FindMeshDefects[ℛ, "SingularEdges", MeshCellHighlight -> {{1, 1} -> {Thick, Yellow}, {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}]}];FindMeshDefects[ℛ, "SingularEdges", MeshCellHighlight -> {Line[{6, 5}] -> {Thick, Yellow}, 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}]}];FindMeshDefects[ℛ, "SingularEdges", 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}]}];FindMeshDefects[ℛ, "SingularEdges", MeshCellLabel -> {{1, 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}]}];FindMeshDefects[ℛ, "SingularEdges", MeshCellLabel -> {Line[{6, 5}] -> "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}}]];FindMeshDefects[ℛ, "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}}]];FindMeshDefects[ℛ, "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}}]];FindMeshDefects[ℛ, "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}}]];FindMeshDefects[ℛ, "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}}]];FindMeshDefects[ℛ, "FlippedFaces", MeshCellShapeFunction -> {Point[1] -> (Sphere[#, .1]&), Point[2] -> (Sphere[#, .15]&)}]MeshCellStyle (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}}]];FindMeshDefects[ℛ, "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}}]];FindMeshDefects[ℛ, "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}}]];FindMeshDefects[ℛ, "FlippedFaces", MeshCellStyle -> {Line[{3, 2}] -> {Thick, Red}, Line[{2, 1}] -> {Dashed, Black}}]PlotLegends (3)
Use editable placeholders as the legend:
ℛ = 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}]}];FindMeshDefects[ℛ, {"SingularVertices", "DanglingEdges"}, PlotLegends -> Automatic]Use the type being used as the legend:
ℛ = 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}]}];FindMeshDefects[ℛ, {"SingularVertices", "DanglingEdges"}, PlotLegends -> "Defects"]Use Placed to control the placement of legends:
ℛ = 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}]}];FindMeshDefects[ℛ, {"SingularVertices", "DanglingEdges"}, PlotLegends -> Placed["Defects", Below]]PlotTheme (2)
Use a theme with grid lines and a legend:
FindMeshDefects[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:
FindMeshDefects[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"]See Also
Related Guides
Related Workflows
- Make a 3D Printout
History
Text
Wolfram Research (2016), FindMeshDefects, Wolfram Language function, https://reference.wolfram.com/language/ref/FindMeshDefects.html.
CMS
Wolfram Language. 2016. "FindMeshDefects." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FindMeshDefects.html.
APA
Wolfram Language. (2016). FindMeshDefects. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindMeshDefects.html
BibTeX
@misc{reference.wolfram_2026_findmeshdefects, author="Wolfram Research", title="{FindMeshDefects}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/FindMeshDefects.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_findmeshdefects, organization={Wolfram Research}, title={FindMeshDefects}, year={2016}, url={https://reference.wolfram.com/language/ref/FindMeshDefects.html}, note=[Accessed: 12-June-2026]}