MeshPrimitives[mreg,d]
gives the graphics primitives for cells of dimension d in the mesh region mreg.
MeshPrimitives[mreg,cellspec]
gives the primitives specified by cellspec.
MeshPrimitives
MeshPrimitives[mreg,d]
gives the graphics primitives for cells of dimension d in the mesh region mreg.
MeshPrimitives[mreg,cellspec]
gives the primitives specified by cellspec.
Details
- The primitives returned have the form prim[{p1,p2,…}] where pk are points with explicit coordinates.
- The mesh region mreg can be either MeshRegion or BoundaryMeshRegion.
- The cell specification cellspec follows the standard form described for MeshRegion and BoundaryMeshRegion.
- MeshCellCount can be used to find the maximum number of primitives for each dimension.
Examples
open all close allBasic Examples (2)
Mesh primitives for a MeshRegion in 2D:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, Polygon[{1, 2, 3, 4}]]The 0D cell primitives include all the corner points:
MeshPrimitives[ℛ, 0]Show[ℛ, Graphics[{Red, %}]]The 1D cell primitives include all the edges:
MeshPrimitives[ℛ, 1]Show[ℛ, Graphics[{Red, %}]]The only 2D cell primitive is used as input:
MeshPrimitives[ℛ, 2]Mesh cell primitives for a MeshRegion in 3D:
ℛ = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Tetrahedron[{{1, 2, 3, 5}, {1, 3, 4, 5}}], MeshCellStyle -> 2 -> Opacity[0.3]]MeshPrimitives[ℛ, 0]Show[ℛ, Graphics3D[{Red, %}]]MeshPrimitives[ℛ, 1]Show[ℛ, Graphics3D[{Red, %}]]MeshPrimitives[ℛ, 2]Show[ℛ, Graphics3D[{Opacity[0.2, Red], %}]]Scope (8)
Mesh primitives for a MeshRegion in 1D:
ℛ = MeshRegion[{{0}, {1}, {2}}, {Line[{1, 2}], Point[3]}]The 0D cell primitives include the end points:
MeshPrimitives[ℛ, 0]The 1D cell primitives include all the line segments:
MeshPrimitives[ℛ, 1]Mesh primitives for a MeshRegion in 2D:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, Polygon[{1, 2, 3, 4}]]The 0D cell primitives include all the corner points:
MeshPrimitives[ℛ, 0]Show[ℛ, Graphics[{Red, %}]]The 1D cell primitives include all the edges:
MeshPrimitives[ℛ, 1]Show[ℛ, Graphics[{Red, %}]]The only 2D cell primitive is used as input:
MeshPrimitives[ℛ, 2]Show[ℛ, Graphics[{Red, %}]]Mesh cell primitives for a MeshRegion in 3D:
ℛ = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Tetrahedron[{{1, 2, 3, 5}, {1, 3, 4, 5}}], MeshCellStyle -> 2 -> Opacity[0.3]]MeshPrimitives[ℛ, 0]Show[ℛ, Graphics3D[{Red, %}]]MeshPrimitives[ℛ, 1]Show[ℛ, Graphics3D[{Red, %}]]MeshPrimitives[ℛ, 2]Show[ℛ, Graphics3D[{Opacity[0.2, Red], %}]]Specify a list of 1D cell primitives:
ℛ = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Tetrahedron[{{1, 2, 3, 5}, {1, 3, 4, 5}}], MeshCellStyle -> 2 -> Opacity[0.3]]MeshPrimitives[ℛ, {1, {2, 5, 6}}]Show[ℛ, Graphics3D[{Red, %}]]Alternatively, you can specify a head and indices:
MeshPrimitives[ℛ, {Line[{1, 2, 5, 1}]}]Show[ℛ, Graphics3D[{Red, %}]]Use a pattern to get every odd 0D cell primitive:
ℛ = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Tetrahedron[{{1, 2, 3, 5}, {1, 3, 4, 5}}], MeshCellStyle -> 2 -> Opacity[0.3]]MeshPrimitives[ℛ, {0, _ ? OddQ}]Show[ℛ, Graphics3D[{PointSize[Large], Red, %}]]All 0D cell primitives:
MeshPrimitives[ℛ, {0, All}]Show[ℛ, Graphics3D[{PointSize[Large], Red, %}]]ℛ = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Tetrahedron[{{1, 2, 3, 5}, {1, 3, 4, 5}}], MeshCellStyle -> 2 -> Opacity[0.3]]MeshPrimitives[ℛ, {2, {2, 5}}]Show[ℛ, Graphics3D[{Opacity[0.2, Red], %}]]A list of mixed-dimensional cell primitives:
MeshPrimitives[ℛ, {{0, 5}, {1, 1}, {2, 5}}]Show[ℛ, Graphics3D[{PointSize[Large], Red, %}]]Specify a list of 0D cell primitives from a 2D BoundaryMeshRegion:
ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]]MeshPrimitives[ℛ, {Point[{1, 3}]}]Show[ℛ, Graphics[{PointSize[Large], Red, %}]]Specify a list of 0D and 1D cell primitives from a 3D BoundaryMeshRegion:
ℛ = BoundaryMeshRegion[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}]]MeshPrimitives[ℛ, 0 | 1]Show[ℛ, Graphics3D[{PointSize[Large], Red, %}]]Properties & Relations (1)
MeshCellCount can be used to find the maximum number of primitives for each dimension:
ℛ = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Tetrahedron[{{1, 2, 3, 5}, {1, 3, 4, 5}}], MeshCellStyle -> 2 -> Opacity[0.3]]{MeshCellCount[ℛ], Length /@ MeshPrimitives[ℛ, All]}Related Guides
History
Text
Wolfram Research (2014), MeshPrimitives, Wolfram Language function, https://reference.wolfram.com/language/ref/MeshPrimitives.html.
CMS
Wolfram Language. 2014. "MeshPrimitives." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MeshPrimitives.html.
APA
Wolfram Language. (2014). MeshPrimitives. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MeshPrimitives.html
BibTeX
@misc{reference.wolfram_2026_meshprimitives, author="Wolfram Research", title="{MeshPrimitives}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/MeshPrimitives.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_meshprimitives, organization={Wolfram Research}, title={MeshPrimitives}, year={2014}, url={https://reference.wolfram.com/language/ref/MeshPrimitives.html}, note=[Accessed: 13-June-2026]}