Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the feature edges of a mesh region
ResourceFunction["MeshFeatureEdges"][mreg] identifies the feature edges of the mesh region mreg. | |
ResourceFunction["MeshFeatureEdges"][mreg, θ] identifies edges connecting faces with a dihedral angle greater than θ. | |
ResourceFunction["MeshFeatureEdges"][…, form] gives the results in the format specified by form. |

| "IncludeIsolatedEdges" | True | whether to include edges with no adjacent faces |
| "IncludeBoundaryEdges" | True | whether to include edges with a single adjacent face |
| "IncludeSingularEdges" | True | whether to include edges with more than two adjacent faces |
| Automatic | mesh region with feature edges highlighted |
| "Indices" | indices of feature edge mesh cells |
| "Cells" | feature edge mesh cells |
| "Primitives" | feature edge primitives |
| "GraphicsComplex" | graphics complex containing only feature edges |
| "Region" | mesh region containing only feature edges |
| {form1,form2,…} | list of multiple forms formi |
Find and highlight the feature edges of a mesh:
| In[1]:= | ![]() |
| Out[1]= | ![]() |
Find feature edges using different angle thresholds:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
Apply custom styling to feature edges:
| In[3]:= | ![]() |
| In[4]:= |
| Out[4]= | ![]() |
MeshFeatureEdges works with MeshRegion, BoundaryMeshRegion, and other linear regions:
| In[5]:= |
| Out[5]= | ![]() |
MeshFeatureEdges works with open and closed regions:
| In[6]:= | ![]() |
| Out[6]= | ![]() |
MeshFeatureEdges works on meshes with multiple dimensional components:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
Specify the dihedral angle threshold used to identify feature edges:
| In[8]:= | ![]() |
| Out[8]= | ![]() |
A negative angle threshold will identify all edges as feature edges:
| In[9]:= | ![]() |
| Out[9]= | ![]() |
An angle threshold of Infinity results in no manifold edges being classified as feature edges:
| In[10]:= | ![]() |
| Out[10]= | ![]() |
Non-manifold edges are not affected by the angle threshold:
| In[11]:= | ![]() |
| Out[11]= | ![]() |
By default, MeshFeatureEdges returns a mesh with the feature edges highlighted:
| In[12]:= | ![]() |
| Out[12]= | ![]() |
Use "Region" to get a mesh consisting only of the feature edges:
| In[13]:= | ![]() |
| Out[13]= | ![]() |
Use "GraphicsComplex" to get a GraphicsComplex for efficiently rendering all the feature edges:
| In[14]:= | ![]() |
Apply custom styling:
| In[15]:= |
| Out[15]= | ![]() |
Use "Primitives" to get the a list of Line primitives for the feature edges:
| In[16]:= | ![]() |
| In[17]:= |
| Out[17]= | ![]() |
Use "Indices" to get the indices of the feature edge cells:
| In[18]:= | ![]() |
| Out[18]= |
Use "Cells" to get the feature edge cells with indexed coordinates:
| In[19]:= | ![]() |
| Out[19]= |
Use a list of multiple forms to avoid repeated computation:
| In[20]:= | ![]() |
| Out[20]= | ![]() |
Whether to include edges with no adjacent faces:
| In[21]:= | ![]() |
| Out[21]= | ![]() |
Whether to include edges with a single adjacent face:
| In[22]:= | ![]() |
| Out[22]= | ![]() |
Whether to include edges with more than two adjacent faces:
| In[23]:= | ![]() |
| Out[23]= | ![]() |
Avoid rendering edges between coplanar polygons:
| In[24]:= | ![]() |
| Out[25]= | ![]() |
Only render edges that represent a significant change in the surface direction:
| In[26]:= | ![]() |
| Out[27]= | ![]() |
Determine which edges should be drawn as hard when computing custom vertex normals:
| In[28]:= | ![]() |
| Out[29]= | ![]() |
MeshFeatureEdges only works on linear regions:
| In[30]:= |
| Out[30]= |
Convert the region to a mesh before finding feature edges:
| In[31]:= |
| Out[31]= | ![]() |
Oriented face normals are used for dihedral calculations, so the edges on a flipped face may not be classified as expected:
| In[32]:= | ![]() |
| In[33]:= |
| Out[33]= | ![]() |
| In[34]:= |
| Out[34]= | ![]() |
Use RepairMesh to fix flipped faces:
| In[35]:= |
| Out[35]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License