---
title: "BoundaryMeshRegion"
language: "en"
type: "Symbol"
summary: "BoundaryMeshRegion[{p1, p2, ...}, {bcell1[{i1, ...}], bcell2[{j1, ...}], ...}] yields a mesh with boundary cells bcellj, where coordinates given as integer i are taken to be pi, where the cells together represent a closed curve, surface, etc. BoundaryMeshRegion[..., {..., wi[bcelli[...]], ...}] yields a mesh with cell properties defined by the symbolic wrapper wi. BoundaryMeshRegion[..., boundary1, boundary2, ...] yields a mesh from multiple boundaries boundaryi."
keywords: 
- boundary representation
- brep
- boundary curve
- boundary surface
- polygon
- polygon with holes
- ring
- polygon rings
- polyhedron
- polyhedron with voids
- shell
- polyhedron shells
canonical_url: "https://reference.wolfram.com/language/ref/BoundaryMeshRegion.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Mesh-Based Geometric Regions"
    link: "https://reference.wolfram.com/language/guide/MeshRegions.en.md"
  - 
    title: "Geometric Computation"
    link: "https://reference.wolfram.com/language/guide/GeometricComputation.en.md"
  - 
    title: "Partial Differential Equations"
    link: "https://reference.wolfram.com/language/guide/PDEModelingAndAnalysis.en.md"
  - 
    title: "Polyhedra"
    link: "https://reference.wolfram.com/language/guide/Polyhedra.en.md"
  - 
    title: "3D Printing"
    link: "https://reference.wolfram.com/language/guide/3DPrinting.en.md"
related_workflows: 
  - 
    title: "Make a 3D Printout"
    link: "https://reference.wolfram.com/language/workflow/MakeA3DPrintout.en.md"
---
# BoundaryMeshRegion

BoundaryMeshRegion[{p1, p2, …}, {bcell1[{i1, …}], bcell2[{j1, …}], …}] yields a mesh with boundary cells bcellj, where coordinates given as integer i are taken to be pi, where the cells together represent a closed curve, surface, etc.

BoundaryMeshRegion[…, {…, wi[bcelli[…]], …}] yields a mesh with cell properties defined by the symbolic wrapper wi.

BoundaryMeshRegion[…, boundary1, boundary2, …] yields a mesh from multiple boundaries boundaryi.

## Details and Options

* ``BoundaryMeshRegion`` is also known as a boundary representation.

* ``BoundaryMeshRegion`` can represent a piecewise linear and full-dimensional region embedded in dimension 1, 2, or 3.

[image]

* ``BoundaryMeshRegion[…]`` displays in a notebook as a plot of a boundary mesh region.

* ``BoundaryMeshRegion`` is typically constructed using functions such as ``ConvexHullMesh``, ``BoundaryMesh``, ``BoundaryDiscretizeRegion``, and ``BoundaryDiscretizeGraphics``.

* The boundary cells need to represent a closed curve or surface without self-intersections.

* In ``BoundaryMeshRegion[{p1, p2, …}, b1, b2, …]``, the boundary curves or surfaces ``bi`` should not cross themselves or each other.

* In ``BoundaryMeshRegion[{p1, p2, …}, b1, b2, …]``, a point ``p`` is considered to be in the region enclosed by the boundary curves or surfaces ``bi`` if any infinite ray starting at ``p`` crosses the set of boundaries ``bi`` an odd number of times.

* The following special wrappers ``wi`` can be used for boundary faces:

|                                 |                                                  |
| ------------------------------- | ------------------------------------------------ |
| Labeled[cell, …]                | display the cell with labeling                   |
| Style[cell, …]                  | show the cell with the specified style           |
| Annotation[cell, name -> value] | associate the annotation name -> value with cell |

* Each cell in a ``BoundaryMeshRegion`` is given a unique ``MeshCellIndex`` of the form ``{d, i}``, where ``d`` is the geometric dimension and ``i`` is the index.

* For purposes of selecting cells of a ``BoundaryMeshRegion``, the following cell specifications may be used:

|             |                                                     |
| ----------- | --------------------------------------------------- |
| {d, i}      | cell with index i of dimension d                    |
| {d, ispec}  | cells with index specification ispec of dimension d |
| {dspec, …}  | cells of dimensions given by dspec                  |
| h[{i1, …}]  | explicit cell with head h and vertex indices i1, …  |
| {c1, c2, …} | list of explicit cells ci                           |

* The index specification ``ispec`` can have the following form:

|             |                                              |
| ----------- | -------------------------------------------- |
| i           | cell index i                                 |
| {i1, i2, …} | cells with indices ik                        |
| All         | all cells                                    |
| patt        | cells with indices matching the pattern patt |

* The dimension specification ``dspec`` can have the following form:

|      |                                                        |
| ---- | ------------------------------------------------------ |
| d    | explicit dimension d                                   |
| All  | all dimensions from 0 to geometric dimension of region |
| patt | dimensions matching the pattern patt                   |

* ``BoundaryMeshRegion`` contains cells of maximal dimension ``n - 1``, where ``n`` is the embedding dimension.

* ``BoundaryMeshRegion`` is always converted to an optimized representation and treated as raw by functions like ``AtomQ`` for purposes of pattern matching.

* ``BoundaryMeshRegion`` has the same options as ``Graphics`` for embedding dimension two, and the same options as ``Graphics3D`` for embedding dimension three, with the following additions and changes:

|                        |             |                                |
| ---------------------- | ----------- | ------------------------------ |
| MeshCellLabel          | Automatic   | labels and placement for cells |
| MeshCellShapeFunction  | Automatic   | shape functions for cells      |
| MeshCellStyle          | Automatic   | styles for cells               |
| MeshCellHighlight      | {}          | list of highlighted cells      |
| MeshCellMarker         | 0           | integer markers for cells      |
| PlotTheme              | \$PlotTheme | overall theme for the mesh     |

* Possible settings for ``PlotTheme`` include common base themes, font features themes, and size features themes.

* Mesh feature themes affect the plot of mesh cells. Themes include:

|         |            |                     |
| ------- | ---------- | ------------------- |
| [image] | "Points"   | 0D cells            |
| [image] | "Lines"    | 1D cells, wireframe |
| [image] | "Polygons" | 2D cells            |

* Rendering feature themes affect the rendering of meshes. Themes include:

|         |                 |                                      |
| ------- | --------------- | ------------------------------------ |
| [image] | "SampledPoints" | sampled points from mesh cells       |
| [image] | "SphereAndTube" | points as spheres and lines as tubes |
| [image] | "SmoothShading" | smooth shading                       |
| [image] | "FaceNormals"   | normal for each 2D cell              |
| [image] | "LargeMesh"     | optimized for large number of cells  |

* Style and other specifications for cells are effectively applied in the order ``MeshCellStyle``, ``Style``, and other wrappers, with later specifications overriding earlier ones.

* Label style and other specifications for cell labels are effectively applied in the order ``MeshCellLabel`` and ``Labeled``, with later specifications overriding earlier ones.

* ``BoundaryMeshRegion`` can be used with functions such as ``RegionMember``, ``RegionDistance``, ``RegionMeasure``, and ``NDSolve``.

---

## Examples (164)

### Basic Examples (5)

Specify an interval from its boundary points:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0}, {1}}, Point[{1, 2}]]

Out[1]= [image]
```

It is full dimensional:

```wl
In[2]:= {RegionDimension[ℛ], RegionEmbeddingDimension[ℛ]}

Out[2]= {1, 1}
```

The region is bounded:

```wl
In[3]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[3]= {True, {{0., 1.}}}
```

The length and centroid:

```wl
In[4]:= {RegionMeasure[ℛ], RegionCentroid[ℛ]}

Out[4]= {1., {0.5}}
```

Check point membership:

```wl
In[5]:= RegionMember[ℛ, {1 / 2}]

Out[5]= True
```

---

Specify a triangle from its closed boundary curve:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]]

Out[1]= [image]
```

It is full dimensional:

```wl
In[2]:= {RegionDimension[ℛ], RegionEmbeddingDimension[ℛ]}

Out[2]= {2, 2}
```

The region is bounded:

```wl
In[3]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[3]= {True, {{0., 1.}, {0., 1.}}}
```

The area and centroid:

```wl
In[4]:= {RegionMeasure[ℛ], RegionCentroid[ℛ]}

Out[4]= {0.5, {0.333333, 0.333333}}
```

Check point membership:

```wl
In[5]:= RegionMember[ℛ, {1 / 3, 1 / 3}]

Out[5]= True
```

---

Specify a tetrahedron from its closed boundary surface:

```wl
In[1]:= ℛ = 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}}]]

Out[1]= [image]
```

It is full dimensional:

```wl
In[2]:= {RegionDimension[ℛ], RegionEmbeddingDimension[ℛ]}

Out[2]= {3, 3}
```

The region is bounded:

```wl
In[3]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[3]= {True, {{0., 1.}, {0., 1.}, {0., 1.}}}
```

The volume and centroid:

```wl
In[4]:= {RegionMeasure[ℛ], RegionCentroid[ℛ]}

Out[4]= {0.166667, {0.25, 0.25, 0.25}}
```

Check point membership:

```wl
In[5]:= RegionMember[ℛ, {1 / 4, 1 / 4, 1 / 4}]

Out[5]= True
```

---

Specify a 2D region from multiple closed boundary curves:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Line[{5, 6, 7, 8, 5}]];

In[2]:= HighlightMesh[ℛ, Labeled[0, "Index"]]

Out[2]= [image]
```

Find its area:

```wl
In[3]:= Area[ℛ]

Out[3]= 8.
```

---

Specify a 3D region from multiple closed boundary surfaces:

```wl
In[1]:=
pts = {{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1}, {1, 0, 1}};
pts1 = ScalingTransform[{3, 3, 3}][pts];
pts2 = TranslationTransform[{1, 1, 1}][pts];
hex = {{2, 3, 4, 1}, {1, 4, 8, 5}, {4, 3, 7, 8}, {3, 2, 6, 7}, {2, 1, 5, 6}, {5, 8, 7, 6}};

In[2]:= ℛ = BoundaryMeshRegion[Join[pts1, pts2], Polygon[hex], Polygon[hex + 8], MeshCellStyle -> Opacity[0.3]];

In[3]:= HighlightMesh[ℛ, Labeled[0, "Index"]]

Out[3]= [image]
```

Find its volume:

```wl
In[4]:= Volume[ℛ]

Out[4]= 26.
```

### Scope (18)

#### Regions in 1D (4)

Specify an interval from its boundary points:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0}, {1}}, Point[{1, 2}]]

Out[1]= [image]
```

Label the points with ``HighlightMesh`` :

```wl
In[2]:= HighlightMesh[ℛ, Labeled[0, "Index"]]

Out[2]= [image]
```

It is full dimensional:

```wl
In[3]:= {RegionDimension[ℛ], RegionEmbeddingDimension[ℛ]}

Out[3]= {1, 1}
```

The region is bounded:

```wl
In[4]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[4]= {True, {{0., 1.}}}
```

The length and centroid:

```wl
In[5]:= {RegionMeasure[ℛ], RegionCentroid[ℛ]}

Out[5]= {1., {0.5}}
```

Check point membership:

```wl
In[6]:= RegionMember[ℛ, {0}]

Out[6]= True
```

---

Specify a 1D region from multiple boundary points:

```wl
In[1]:= BoundaryMeshRegion[{{0}, {3}, {6}, {9}}, {Point[{1, 2}], Point[{3, 4}]}]

Out[1]= [image]
```

---

Apply ``Style`` to boundary points:

```wl
In[1]:= BoundaryMeshRegion[{{0}, {1}}, Style[Point[{1, 2}], Red]]

Out[1]= [image]
```

---

Label boundary points:

```wl
In[1]:= BoundaryMeshRegion[{{0}, {1}}, Labeled[Point[{1, 2}], "Index"]]

Out[1]= [image]
```

#### Regions in 2D (4)

Specify a triangle from its closed boundary curve:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {3, 0}, {0, 3}}, Line[{1, 2, 3, 1}]]

Out[1]= [image]
```

Label the segments with ``HighlightMesh`` :

```wl
In[2]:= HighlightMesh[ℛ, Labeled[1, "Index"]]

Out[2]= [image]
```

It is full dimensional:

```wl
In[3]:= {RegionDimension[ℛ], RegionEmbeddingDimension[ℛ]}

Out[3]= {2, 2}
```

The region is bounded:

```wl
In[4]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[4]= {True, {{0., 3.}, {0., 3.}}}
```

The area and centroid:

```wl
In[5]:= {RegionMeasure[ℛ], RegionCentroid[ℛ]}

Out[5]= {4.5, {1., 1.}}
```

Check point membership:

```wl
In[6]:= RegionMember[ℛ, {1, 1}]

Out[6]= True
```

---

Specify a 2D region from multiple closed boundary curves:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Line[{5, 6, 7, 8, 5}]];
```

Label the points with their corresponding indexes with ``HighlightMesh`` :

```wl
In[2]:= HighlightMesh[ℛ, Labeled[0, "Index"]]

Out[2]= [image]
```

---

Apply ``Style`` to specific boundary lines:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Style[Line[{5, 6, 7, 8, 5}], Red]]

Out[1]= [image]
```

---

Label specific boundary lines:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Labeled[Line[{5, 6, 7, 8, 5}], "Index"]]

Out[1]= [image]
```

#### Regions in 3D (4)

Specify a tetrahedron from its closed boundary surface:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0, 0}, {4, 0, 0}, {0, 4, 0}, {0, 0, 4}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}]]

Out[1]= [image]
```

Label the segments with ``HighlightMesh`` :

```wl
In[2]:= HighlightMesh[ℛ, Labeled[1, "Index"]]

Out[2]= [image]
```

It is full dimensional:

```wl
In[3]:= {RegionDimension[ℛ], RegionEmbeddingDimension[ℛ]}

Out[3]= {3, 3}
```

The region is bounded:

```wl
In[4]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[4]= {True, {{0., 4.}, {0., 4.}, {0., 4.}}}
```

The volume and centroid:

```wl
In[5]:= {RegionMeasure[ℛ], RegionCentroid[ℛ]}

Out[5]= {10.6667, {1., 1., 1.}}
```

Check point membership:

```wl
In[6]:= RegionMember[ℛ, {1, 1, 1}]

Out[6]= True
```

---

Specify a 3D region from multiple closed boundary surfaces:

```wl
In[1]:=
pts = {{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1}, {1, 0, 1}};
pts1 = ScalingTransform[{3, 3, 3}][pts];
pts2 = TranslationTransform[{1, 1, 1}][pts];
hex = {{2, 3, 4, 1}, {1, 4, 8, 5}, {4, 3, 7, 8}, {3, 2, 6, 7}, {2, 1, 5, 6}, {5, 8, 7, 6}};

In[2]:= ℛ = BoundaryMeshRegion[Join[pts1, pts2], Polygon[hex], Polygon[hex + 8], MeshCellStyle -> Opacity[0.3]];

In[3]:= HighlightMesh[ℛ, Labeled[0, "Index"]]

Out[3]= [image]
```

---

Apply ``Style`` to specific boundary faces:

```wl
In[1]:=
pts = {{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}};
i = {{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}};

In[2]:= BoundaryMeshRegion[Join[pts, pts / 2], Polygon[i + 4], Style[Polygon[i], Opacity[0.5, Red]]]

Out[2]= [image]
```

---

Label specific boundary faces:

```wl
In[1]:=
pts = {{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}};
i = {{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}};

In[2]:= BoundaryMeshRegion[Join[pts, pts / 2], Polygon[i + 4], Labeled[Polygon[i], "Index"]]

Out[2]= [image]
```

#### Presentation (6)

Use a theme to draw 0D cells:

```wl
In[1]:= BoundaryMeshRegion[[image], PlotTheme -> "Points"]

Out[1]= [image]
```

---

Use a theme to draw 1D cells or a wireframe:

```wl
In[1]:= BoundaryMeshRegion[[image], PlotTheme -> "Lines"]

Out[1]= [image]
```

---

Use a theme to draw 2D cells:

```wl
In[1]:= BoundaryMeshRegion[[image], PlotTheme -> "Polygons"]

Out[1]= [image]
```

---

Use a theme to draw sampled points from mesh cells:

```wl
In[1]:= BoundaryMeshRegion[[image], PlotTheme -> "SampledPoints"]

Out[1]= [image]
```

---

Use a theme to smooth the shading:

```wl
In[1]:= BoundaryMeshRegion[[image], PlotTheme -> "SmoothShading"]

Out[1]= [image]
```

---

Use a theme to draw normals for each 2D cell:

```wl
In[1]:= BoundaryMeshRegion[[image], PlotTheme -> "FaceNormals"]

Out[1]= [image]
```

### Options (127)

#### AlignmentPoint (1)

Specify the position to be aligned in 3D ``Inset``, using $0,1$ coordinates:

```wl
In[1]:= Table[Graphics[{Inset[BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], ImageSize -> 50, AlignmentPoint -> {a, 0}], {0, 0}]}, ImageSize -> 100, Axes -> True, Ticks -> None], {a, {0, 1 / 2, 1}}]

Out[1]= {[image], [image], [image]}

In[2]:= Table[Graphics[{Inset[BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], ImageSize -> 50, AlignmentPoint -> {1 / 2, a}], {0, 0}]}, ImageSize -> 100, Axes -> True, Ticks -> None], {a, {0, 1 / 2, 1}}]

Out[2]= {[image], [image], [image]}
```

#### AspectRatio (1)

Use numerical values for ``AspectRatio`` :

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], AspectRatio -> 1 / k], {k, 1, 3}]

Out[1]= {[image], [image], [image]}
```

#### Axes (2)

Draw all the axes:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True]

Out[1]= [image]
```

---

Draw the $y$ axis, but not the $x$ axis:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> {False, True}]

Out[1]= [image]
```

#### AxesEdge (2)

Choose the bounding box edges automatically to draw the axes:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> True, Axes -> True, AxesEdge -> Automatic]

Out[1]= [image]
```

---

Choose the bounding box edges automatically to draw the axes:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> True, Axes -> True, AxesEdge -> {{1, 1}, None, None}]

Out[1]= [image]
```

#### AxesLabel (2)

Place a label for the $y$ axis:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesLabel -> y]

Out[1]= [image]
```

---

Specify a label for each axis:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesLabel -> {x, y}]

Out[1]= [image]
```

#### AxesOrigin (2)

Determine where the axes cross automatically :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesOrigin -> Automatic]

Out[1]= [image]
```

---

Specify the axes' origin explicitly:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesOrigin -> {0, 1}]

Out[1]= [image]
```

#### AxesStyle (2)

Specify the overall axes style, including the ticks and the tick labels:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesStyle -> Directive[Orange, 12]]

Out[1]= [image]
```

---

Specify the style of each axis:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesStyle -> {Directive[Dashed, Red], Blue}]

Out[1]= [image]
```

#### Background (1)

Specify the style of each axis:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Background -> LightBlue]

Out[1]= [image]
```

#### BaselinePosition (3)

Align the center of a graphic with the baseline of the text:

```wl
In[1]:= {x, BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageSize -> 50, BaselinePosition -> Center], y}

Out[1]= {x, [image], y}
```

---

Specify the baseline of a graphic as a fraction of the height by using ``Scaled`` :

```wl
In[1]:= Table[{x, BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageSize -> 50, BaselinePosition -> Scaled[b]]}, {b, {0, 0.5, 1}}]

Out[1]= {{x, [image]}, {x, [image]}, {x, [image]}}
```

---

Use the axis of a graphic as the baseline:

```wl
In[1]:= {x, BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageSize -> 50, BaselinePosition -> Axis], y}

Out[1]= {x, [image], y}
```

#### BaseStyle (2)

Set the starting style:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], BaseStyle -> Blue]

Out[1]= [image]
```

---

Set multiple starting styles:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], BaseStyle -> {Green, Thick, EdgeForm[Dashed]}]

Out[1]= [image]
```

#### Boxed (2)

Draw the edges of the bounding box:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> True]

Out[1]= [image]
```

---

Do not draw the edges of the bounding box:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> False]

Out[1]= [image]
```

#### BoxRatios (2)

Specify the ratios between the bounding box edges:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> True, BoxRatios -> {1, 2, 3}]

Out[1]= [image]
```

---

Use the actual coordinate values for the ratios:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> True, Axes -> True, BoxRatios -> Automatic]

Out[1]= [image]
```

#### BoxStyle (1)

Use dashed lines for the bounding box:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Boxed -> True, BoxStyle -> Directive[Dashed]]

Out[1]= [image]
```

#### Epilog (1)

Draw a disk above the graphic, including the axes:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, Epilog -> {Blue, Disk[{1, 1 / 2}, .4]}]

Out[1]= [image]
```

#### FaceGrids (4)

Put grids on every face of a 3D graphic:

```wl
In[1]:= MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Pyramid[{1, 2, 3, 4, 5}], Axes -> True, Boxed -> True, FaceGrids -> All]

Out[1]= [image]
```

---

Put grids on both $x$‐$y$ faces:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Axes -> True, Boxed -> True, FaceGrids -> {{0, 0, 1}, {0, 0, -1}}]

Out[1]= [image]
```

---

Put face grids on the $y=y_{\text{\textit{min}}}$ plane:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Axes -> True, Boxed -> True, FaceGrids -> {{0, -1, 0}}]

Out[1]= [image]
```

---

On the $y=y_{\text{\textit{min}}}$ plane, put grid lines on $x=1$, $z=\frac{2}{3}$, and $z=\frac{4}{3}$ :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Axes -> True, Boxed -> True, FaceGrids -> {{{0, -1, 0}, {{1}, {2 / 3, 4 / 3}}}}]

Out[1]= [image]
```

#### FaceGridsStyle (1)

Specify the overall style of face grids:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], FaceGrids -> All, FaceGridsStyle -> Directive[Orange, Dashed]]

Out[1]= [image]
```

#### Frame (2)

Draw a frame around the whole graphic:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True]

Out[1]= [image]
```

---

Draw a frame on the left and the right edges:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> {{True, True}, {False, False}}]

Out[1]= [image]
```

#### FrameLabel (2)

Specify frame labels for the bottom and the left edges:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameLabel -> {x, y}]

Out[1]= [image]
```

---

Specify labels for each edge:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameLabel -> {{a, b}, {c, d}}]

Out[1]= [image]
```

#### FrameStyle (2)

Specify the overall frame style:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameStyle -> Directive[Thick, Gray]]

Out[1]= [image]
```

---

Specify the style of each frame edge:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameStyle -> {{Thick, Directive[Thick, Dashed]}, {Blue, Red}}]

Out[1]= [image]
```

#### FrameTicks (3)

Put a frame, but no ticks:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicks -> None]

Out[1]= [image]
```

---

Tick mark labels on the bottom and the left frame edges:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicks -> Automatic]

Out[1]= [image]
```

---

Frame ticks on the bottom and the right edges:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicks -> {{None, Automatic}, {Automatic, None}}]

Out[1]= [image]
```

#### FrameTicksStyle (2)

Specify frame tick and frame tick label style:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicksStyle -> Directive[Orange, 12]]

Out[1]= [image]
```

---

Specify frame tick style for each edge:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicksStyle -> {{Black, Blue}, {Red, Green}}]

Out[1]= [image]
```

#### GridLines (3)

Put grids across a 2D graphic:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], GridLines -> Automatic]

Out[1]= [image]
```

---

Draw grid lines at specific positions:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, GridLines -> {{.5, 1.5}, {.5, 1.5}}]

Out[1]= [image]
```

---

Specify the style of each grid:

```wl
In[1]:= BoundaryMeshRegion[{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, GridLines -> {{{-1, Orange}, {-.5, Dotted}, {.5, Dotted}, {1, Orange}}, {0, {.5, Dotted}, {1.5, Dotted}, 2}}]

Out[1]= [image]
```

#### GridLinesStyle (1)

Specify the overall grid style:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, GridLines -> Automatic, GridLinesStyle -> Directive[Red, Dotted]]

Out[1]= [image]
```

#### ImageMargins (3)

Allow no margins outside of ``ImageSize`` :

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}]]]

Out[1]= [image]
```

---

Have 20-point margins on all sides:

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageMargins -> 20]]

Out[1]= [image]
```

---

Draw grid lines at specific positions:

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageMargins -> {{5, 10}, {20, 30}}]]

Out[1]= [image]
```

#### ImagePadding (4)

Leave no padding outside of the plot range:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImagePadding -> None, Frame -> True, FrameLabel -> {x, y}]

Out[1]= [image]
```

---

Leave enough padding for all objects and labels that are present:

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImagePadding -> All, Frame -> True, FrameLabel -> {x, y}], FrameMargins -> 0]

Out[1]= [image]
```

---

Specify the same padding for all sides in printer's points:

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImagePadding -> 40, Frame -> True]]

Out[1]= [image]
```

---

Specify the same padding for all sides in printer's points:

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImagePadding -> {{40, 10}, {20, 5}}, Frame -> True]]

Out[1]= [image]
```

#### ImageSize (3)

Use predefined symbolic sizes:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageSize -> s], {s, {Tiny, Small}}]

Out[1]= {[image], [image]}
```

---

Use an explicit image width:

```wl
In[1]:= {BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageSize -> 100], BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, 3}}, Line[{1, 2, 3, 1}], ImageSize -> 100]}

Out[1]= {[image], [image]}
```

---

Use an explicit image width and height:

```wl
In[1]:= {BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], ImageSize -> {100, 100}], BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, 3}}, Line[{1, 2, 3, 1}], ImageSize -> {100, 100}]}

Out[1]= {[image], [image]}
```

#### LabelStyle (1)

Specify the overall style of all the label-like elements:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, AxesLabel -> {x, y}, LabelStyle -> Orange]

Out[1]= [image]
```

#### Lighting (4)

Ambient light is uniformly applied to all the surfaces in the scene:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Lighting -> {{"Ambient", Orange}}]

Out[1]= [image]
```

---

Directional lights with different colors:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Lighting -> {{"Directional", c, {{1.5, 0, 2}, {0, 0, 0}}}}], {c, {Red, Yellow, Blue}}]

Out[1]= {[image], [image], [image]}
```

---

Point lights with different colors:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Lighting -> {{"Point", c, {1.5, 0, 3}}}], {c, {Red, Yellow, Blue}}]

Out[1]= {[image], [image], [image]}
```

---

Spotlights with different colors:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], Lighting -> {{"Spot", c, {{1, 1, 2.5}, {1, 1, 2}}, Pi / 8}}], {c, {Red, Yellow, Blue}}]

Out[1]= {[image], [image], [image]}
```

#### MeshCellHighlight (3)

``MeshCellHighlight`` allows you to specify highlighting for parts of a ``BoundaryMeshRegion`` :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellHighlight -> {{1, All} -> Red, {0, All} -> Black}]

Out[1]= [image]
```

---

By making faces transparent, the internal structure of a 3D ``BoundaryMeshRegion`` can be seen:

```wl
In[1]:= 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}}], MeshCellHighlight -> {{2, All} -> Opacity[0.5, Orange]}]

Out[1]= [image]
```

---

Individual cells can be highlighted using their cell index:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellHighlight -> {{1, 1} -> {Thick, Red}, {1, 2} -> {Dashed, Black}}]

Out[1]= [image]

In[2]:= MeshRegion[{{0}, {1}, {2}}, Line[{{1, 2, 3}}], MeshCellHighlight -> {{1, 1} -> {Thick, Red}, {1, 2} -> {Dashed, Black}}]

Out[2]= [image]
```

Or by the cell itself:

```wl
In[3]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellHighlight -> {Line[{1, 2}] -> {Thick, Red}, Line[{2, 3}] -> {Dashed, Black}}]

Out[3]= [image]
```

#### MeshCellLabel (11)

``MeshCellLabel`` can be used to label parts of a ``BoundaryMeshRegion`` :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Line[{5, 6, 7, 8, 5}], MeshCellLabel -> {1 -> "Index"}]

Out[1]= [image]
```

---

``MeshCellLabel`` can reveal a cell's index with ``"Index"``, ``"CellIndex"``, or ``"Cell"`` :

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {{{0, 3}, {1, 2}} -> cl}], {cl, {"Index", "CellIndex", "Cell"}}]

Out[1]= {[image], [image], [image]}
```

---

Any expression can be used as a label:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {6, 0}, {3, 3}, {3, 6}, {0, 3}}, Line[{1, 2, 3, 4, 5, 1}], MeshCellLabel -> {0 -> "Index", {{1, 1}} -> [image], {{1, 2}} -> Sqrt[a^2 + b^2], {1, 3} -> "North", {1, 4} -> [image], {1, 5} -> [image]}]

Out[1]= [image]
```

---

Label all cells with tooltips:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {All -> Placed["Cell", Tooltip]}]

Out[1]= [image]
```

---

``All`` can be used to specify all cells:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {All -> "x"}]

Out[1]= [image]
```

By default, all cells are labeled:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> "x"]

Out[2]= [image]
```

---

Label all cells of a given dimension:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {0 -> "point", 1 -> "line"}]

Out[1]= [image]
```

---

Label specific vertices and edges of a polygon:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {{0, {1, 2}} -> "Index", {1, 1} -> "Cell"}]

Out[1]= [image]
```

Alternatively, you can specify a head and indices:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {Point[{1, 2}] -> "Index", Line[{1, 2}] -> "Cell"}]

Out[2]= [image]
```

---

Specify a list of cell indices to label:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {{{0, 1}, {1, 2}} -> "Cell"}]

Out[1]= [image]
```

---

Label cells whose dimensions match a pattern:

```wl
In[1]:= 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}}], MeshCellLabel -> {{0 | 2} -> "CellIndex"}]

Out[1]= [image]
```

---

Label cells whose indices match a pattern:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Line[{5, 6, 7, 8, 5}], MeshCellLabel -> {{1, _ ? EvenQ} -> "Index"}]

Out[1]= [image]
```

---

Wrappers have precedence over options:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Labeled[Line[{1, 2, 3, 4, 1}], "x"], Line[{5, 6, 7, 8, 5}], MeshCellLabel -> {1 -> "Index"}]

Out[1]= [image]
```

#### MeshCellMarker (1)

``MeshCellMarker`` can be used to assign values to parts of a ``BoundaryMeshRegion`` :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellMarker -> {{1, 1} -> 1, {1, 2} -> 2, {1, 3} -> 3}]

Out[1]= [image]
```

Use ``MeshCellLabel`` to show the markers:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellLabel -> {1 -> "Marker"}, MeshCellMarker -> {{1, 1} -> 1, {1, 2} -> 2, {1, 3} -> 3}]

Out[2]= [image]
```

#### MeshCellShapeFunction (2)

``MeshCellShapeFunction`` allows you to specify functions for parts of a ``BoundaryMeshRegion`` :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellShapeFunction -> {1 -> (Arrow[#]&), 0 -> (Disk[#, .05]&)}]

Out[1]= [image]
```

---

Individual cells can be drawn using their cell index:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellShapeFunction -> {{0, 1} -> (Disk[#, .1]&), {0, 2} -> (Disk[#, {.1, .05}]&)}]

Out[1]= [image]
```

Or by the cell itself:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellShapeFunction -> {Point[1] -> (Disk[#, .1]&), Point[2] -> (Disk[#, {.1, .05}]&)}]

Out[2]= [image]
```

#### MeshCellStyle (8)

``All`` can be used to specify all cells:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellStyle -> {All -> Red}]

Out[1]= [image]
```

By default, all cells are styled:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellStyle -> Red]

Out[2]= [image]
```

---

Style all cells of a given dimension:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellStyle -> {0 -> {PointSize[Large], Black}, 1 -> Red}]

Out[1]= [image]
```

---

Style specific vertices and edges of a polygon:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellStyle -> {{0, {1, 2}} -> Directive[PointSize[Large], Black], {1, 1} -> Red}]

Out[1]= [image]
```

Alternatively, you can specify a head and indices:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellStyle -> {Point[{1, 2}] -> Directive[PointSize[Large], Black], Line[{1, 2}] -> Red}]

Out[2]= [image]
```

---

Specify a list of cell indices to style:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellStyle -> {{{0, 1}, {1, 2}} -> Red}]

Out[1]= [image]
```

---

Style cells whose dimensions match a pattern:

```wl
In[1]:= 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}}], MeshCellStyle -> {{0 | 1} -> Red}]

Out[1]= [image]
```

---

Style cells whose indices match a pattern:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Line[{1, 2, 3, 4, 1}], Line[{5, 6, 7, 8, 5}], MeshCellStyle -> {{1, _ ? EvenQ} -> Red}]

Out[1]= [image]
```

---

Style with graphics directives appropriate for the dimension of the components:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0, 0}, {4, 0, 0}, {0, 4, 0}, {0, 0, 4}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], MeshCellStyle -> {0 -> {PointSize[Large], Black}, 1 -> {Dashed, Thick, Red}, 2 -> Opacity[0.7, Brown]}]

Out[1]= [image]
```

---

Wrappers have precedence over options:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {2, 1}, {2, 2}, {1, 2}}, Style[Line[{1, 2, 3, 4, 1}], Green], Line[{5, 6, 7, 8, 5}], MeshCellStyle -> {1 -> Red}]

Out[1]= [image]
```

#### PlotLabel (2)

Display a label on the top of the graphic in ``TraditionalForm`` :

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotLabel -> x ^ 2 + y ^ 2 == 1]

Out[1]= [image]
```

---

Use ``Style`` and other typesetting functions to modify how the label appears:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotLabel -> Style[Framed[x ^ 2 + y ^ 2 == 1], 16, Red, Background -> Yellow]]

Out[1]= [image]
```

#### PlotRange (3)

Display all objects:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, PlotRange -> All]

Out[1]= [image]
```

---

Explicitly choose $x$ and $y$ ranges:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotRange -> {{0, 2}, {0, 1}}, Frame -> True]

Out[1]= [image]
```

Force clipping at the ``PlotRange`` :

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotRange -> {{0, 2}, {0, 1}}, PlotRangeClipping -> True, Frame -> True]

Out[2]= [image]
```

---

``PlotRange -> s`` is equivalent to ``PlotRange -> {{-s, s}, {-s, s}}`` :

```wl
In[1]:= BoundaryMeshRegion[{{-2, -2}, {2, -2}, {0, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, PlotRange -> 1]

Out[1]= [image]
```

#### PlotRangeClipping (2)

Allow graphics objects to spread beyond ``PlotRange`` :

```wl
In[1]:= BoundaryMeshRegion[{{-2, -2}, {2, -2}, {0, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, PlotRange -> 1, PlotRangeClipping -> False]

Out[1]= [image]
```

---

Clip all graphics objects at ``PlotRange`` :

```wl
In[1]:= BoundaryMeshRegion[{{-2, -2}, {2, -2}, {0, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, PlotRange -> 1, PlotRangeClipping -> True]

Out[1]= [image]
```

#### PlotRangePadding (3)

Include $1$ coordinate unit of padding on all sides:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotRangePadding -> 1, Frame -> True]

Out[1]= [image]
```

---

Include padding using ``Scaled`` coordinates:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotRangePadding -> Scaled[0.1], Frame -> True]

Out[1]= [image]
```

---

Specify different padding on each side:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], PlotRangePadding -> {{0.5, 1}, {0.3, 0.3}}, Frame -> True]

Out[1]= [image]
```

#### PlotRegion (3)

The contents of a graphic use the whole region:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicks -> False, Background -> LightBlue]

Out[1]= [image]
```

---

Limit the contents of the graphic to the middle half of the region in each direction:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicks -> False, PlotRegion -> {{0.25, 0.75}, {0.25, 0.75}}, Background -> LightBlue]

Out[1]= [image]
```

---

``ImagePadding`` can also be used to add padding around a graphic:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameTicks -> False, ImagePadding -> 30, Background -> LightBlue]

Out[1]= [image]
```

#### PlotTheme (9)

##### Base Themes (2)

Use a common based theme:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "Detailed"]

Out[1]= [image]
```

---

Use a monochrome theme:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "Monochrome"]

Out[1]= [image]
```

##### Feature Themes (7)

Use a theme to draw 0D cells:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "Points"]

Out[1]= [image]
```

---

Use a theme to draw 1D cells or a wireframe:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "Lines"]

Out[1]= [image]
```

---

Use a theme to draw 2D cells:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "Polygons"]

Out[1]= [image]
```

---

Use a theme to draw sampled points from mesh cells:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "SampledPoints"]

Out[1]= [image]
```

---

Use a theme to draw points as spheres and lines as tubes:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "SphereAndTube"]

Out[1]= [image]
```

---

Use a theme to smooth shading:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "SmoothShading"]

Out[1]= [image]
```

---

Use a theme to draw normals for each 2D cell:

```wl
In[1]:= BoundaryMeshRegion[{{1, -1, -3}, {1, -1, 1}, {1, 3, 1}, {-3, -1, 1}}, Polygon[{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}], PlotTheme -> "FaceNormals"]

Out[1]= [image]
```

#### Prolog (1)

Define a simple graphic to use as a background:

```wl
In[1]:= bg = Graphics[Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, VertexColors -> {Orange, Orange, White, White}], AspectRatio -> Full];
```

Use it in multiple boundary mesh regions:

```wl
In[2]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Prolog -> Inset[bg, Scaled[{0, 0}], Scaled[{0, 0}]]]

Out[2]= [image]

In[3]:= BoundaryMeshRegion[{{0, 0}, {3, 0}, {0, 3}}, Line[{1, 2, 3, 1}], Prolog -> Inset[bg, Scaled[{0, 0}], Scaled[{0, 0}]]]

Out[3]= [image]
```

#### RotateLabel (2)

Specify that vertical frame labels should be rotated:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameLabel -> {None, "y axis"}, RotateLabel -> True]

Out[1]= [image]
```

---

Specify that vertical frame labels should not be rotated:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Frame -> True, FrameLabel -> {None, "y axis"}, RotateLabel -> False]

Out[1]= [image]
```

#### SphericalRegion (2)

Make a sequence of images be consistently sized, independent of orientation:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], SphericalRegion -> True, ImageSize -> 80, ViewPoint -> 3.{ Sin[t], Cos[t], 1}], {t, 0, 4}]

Out[1]= {[image], [image], [image], [image], [image]}
```

---

Without ``SphericalRegion``, each image is made as big as possible:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ImageSize -> 80, ViewPoint -> 3.{ Sin[t], Cos[t], 1}], {t, 0, 4}]

Out[1]= {[image], [image], [image], [image], [image]}
```

#### Ticks (3)

Draw the axes, but not tick marks:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, Ticks -> None]

Out[1]= [image]
```

---

Place tick marks automatically:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, Ticks -> Automatic]

Out[1]= [image]
```

---

Draw tick marks at the specific positions:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Ticks -> {{1, 2, 3}, {1, 3}}, Axes -> True]

Out[1]= [image]
```

#### TicksStyle (2)

Specify the styles of the ticks and tick labels:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, TicksStyle -> Directive[Red, Bold]]

Out[1]= [image]
```

---

Specify the styles of $x$ and $y$ axis ticks separately:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0}, {2, 0}, {1, Sqrt[3]}}, Line[{1, 2, 3, 1}], Axes -> True, TicksStyle -> {Directive[Red, Bold], Directive[Blue, 12]}]

Out[1]= [image]
```

#### ViewAngle (1)

Use a specific angle for a simulated camera:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewAngle -> d °], {d, {20, 35, 50}}]

Out[1]= {[image], [image], [image]}
```

#### ViewCenter (1)

Place the top-right corner of the object at the center of the final image:

```wl
In[1]:= Framed[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewCenter -> {1, .5, .5}, SphericalRegion -> True]]

Out[1]= [image]
```

#### ViewMatrix (1)

Orthographic view of a mesh region from the negative $z$ direction:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewMatrix -> {TransformationMatrix[RescalingTransform[{{-1, 1}, {-1, 1}, {-1, 1}}]], {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}}]

Out[1]= [image]
```

#### ViewPoint (3)

Specify the view point using the special scaled coordinates:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> {Pi, Pi / 2, 2}]

Out[1]= [image]
```

---

Use symbolic view points:

```wl
In[1]:=
{BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> Front], 
	BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> Top]}

Out[1]= {[image], [image]}
```

---

Specify orthographic views:

```wl
In[1]:=
{BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> {0, -Infinity, 0}], 
	BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> {0, 0, Infinity}]}

Out[1]= {[image], [image]}
```

#### ViewRange (2)

By default, the range is sufficient to include all the objects:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> {1, 0, 1.5}, SphericalRegion -> True]

Out[1]= [image]
```

---

Specify the minimum and maximum distances from the camera to be included:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewPoint -> {1, 0, 1.5}, ViewRange -> {3.5, 7.2}, SphericalRegion -> True]

Out[1]= [image]
```

#### ViewVector (1)

Specify the view vectors using ordinary coordinates:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewVector -> {{5, -5, 5}, {5, 0, -5}}]

Out[1]= [image]
```

#### ViewVertical (2)

Use the $x$ axis direction as the vertical direction in the final image:

```wl
In[1]:= BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewVertical -> {1, 0, 0}]

Out[1]= [image]
```

---

Various views of vertical directions:

```wl
In[1]:= Table[BoundaryMeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Polygon[{{1, 2, 5}, {1, 5, 4}, {2, 3, 5}, {3, 4, 5}, {1, 4, 3, 2}}], ViewVertical -> v], {v, {{1, 0, 1}, {.5, 0, 1}, {0, -.5, 1}, {0, -1, 1}}}]

Out[1]= {[image], [image], [image], [image]}
```

### Applications (6)

#### Polygons (2)

Non-intersecting polygons are also ``BoundaryMeshRegion`` :

```wl
In[1]:=
RegularPolygonMesh[n_Integer] := 
	BoundaryMeshRegion[Table[{Cos[k 2π / n], Sin[k 2π / n]}, {k, n}], Line[Append[Range[n], 1]]]

In[2]:= Table[RegularPolygonMesh[n], {n, 3, 10}]

Out[2]= {[image], [image], [image], [image], [image], [image], [image], [image]}
```

The resulting regions can be used for computing:

```wl
In[3]:= Area /@ %

Out[3]= {1.29904, 2., 2.37764, 2.59808, 2.73641, 2.82843, 2.89254, 2.93893}
```

The area approaches $\pi$ as the number of sides goes to infinity:

```wl
In[4]:= Table[Area[RegularPolygonMesh[n]], {n, {10, 10 ^ 2, 10 ^ 3}}]

Out[4]= {2.93893, 3.13953, 3.14157}
```

---

Build a ``BoundaryMeshRegion`` in 2D with multiple rectangular holes. The coordinates for the inner rectangles:

```wl
In[1]:=
rectangleCoords[{i_, j_}] := rectangleCoords[{i, j}, {0.5, 0.5}];
rectangleCoords[{i_, j_}, {α_, β_}] := {{i - α / 2, j - β / 2}, {i + α / 2, j - β / 2}, {i + α / 2, j + β / 2}, {i - α / 2, j + β / 2}};
```

The indexes for the inner rectangle closed curves:

```wl
In[2]:= rectangleIndexes[i_] := Line[i - 1 + {1, 2, 3, 4, 1}];
```

Generating an outer rectangle with $m$×$n$ inner rectangle closed curves:

```wl
In[3]:=
RectangleHoleMesh[{m_, n_}] := 
	Module[{oc, hc}, 
	hc = Flatten[Table[rectangleCoords[{i, j}], {j, n}, {i, m}], 2];
	oc = {{0, 0}, {m + 1, 0}, {m + 1, n + 1}, {0, n + 1}};
	BoundaryMeshRegion[Join[hc, oc], 
	rectangleIndexes[4 m n + 1], 
	Sequence@@Table[rectangleIndexes[i], {i, 1, 4 m n, 4}]
	]
	]
```

The resulting mesh can be used for computing:

```wl
In[4]:= RectangleHoleMesh[{20, 10}]

Out[4]= [image]

In[5]:= RegionMeasure[%]

Out[5]= 181.
```

#### Polyhedra (4)

Non-intersecting polyhedra are also a ``BoundaryMeshRegion``:

```wl
In[1]:=
PolyhedronMesh[name_String] := 
	BoundaryMeshRegion[PolyhedronData[name, "Vertices"], Polygon[PolyhedronData[name, "FaceIndices"]]]
```

The Archimedean or semi-regular polyhedra:

```wl
In[2]:= PolyhedronMesh /@ PolyhedronData["Archimedean"]

Out[2]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

---

Color the faces based on the number of vertices:

```wl
In[1]:=
ColoredPolyhedron[name_String] := 
	Module[{faces}, 
	faces = GatherBy[PolyhedronData[name, "FaceIndices"], Length[#]&];
	BoundaryMeshRegion[PolyhedronData[name, "Vertices"], Table[Style[Polygon[faces[[i]]], ColorData[100, i]], {i, Length[faces]}]]
	]
```

Color the faces of Archimedean polyhedra:

```wl
In[2]:= Magnify[ColoredPolyhedron /@ PolyhedronData["Archimedean"], 0.5]

Out[2]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

---

Build a ``BoundaryMeshRegion`` with multiple voids by using multiple inner cuboid boundaries. The coordinates for the inner cuboids:

```wl
In[1]:=
cuboidCoords[{i_, j_, k_}] := cuboidCoords[{i, j, k}, {0.5, 0.5, 0.5}];
cuboidCoords[{i_, j_, k_}, {α_, β_, γ_}] := 
	{{i - α / 2, j - β / 2, k - γ / 2}, {i - α / 2, j + β / 2, k - γ / 2}, {i + α / 2, j + β / 2, k - γ / 2}, {i + α / 2, j - β / 2, k - γ / 2}, {i - α / 2, j - β / 2, k + γ / 2}, {i - α / 2, j + β / 2, k + γ / 2}, {i + α / 2, j + β / 2, k + γ / 2}, {i + α / 2, j - β / 2, k + γ / 2}};
```

The indexes for inner cuboid closed surfaces:

```wl
In[2]:= cuboidIndexes[i_] := Polygon[(i - 1) + {{2, 3, 4, 1}, {1, 4, 8, 5}, {4, 3, 7, 8}, {3, 2, 6, 7}, {2, 1, 5, 6}, {5, 8, 7, 6}}]
```

Generating an outer cuboid with $m$×$n$×$p$ inner cuboid surfaces:

```wl
In[3]:=
CuboidVoidMesh[{m_, n_, p_}] := 
	Module[{oc, vc}, 
	vc = Flatten[Table[cuboidCoords[{i, j, k}], {k, p}, {j, n}, {i, m}], 3];
	oc = {{0, 0, 0}, {0, n + 1, 0}, {m + 1, n + 1, 0}, {m + 1, 0, 0}, {0, 0, p + 1}, {0, n + 1, p + 1}, {m + 1, n + 1, p + 1}, {m + 1, 0, p + 1}};
	BoundaryMeshRegion[Join[vc, oc], 
	cuboidIndexes[8 m n p + 1], 
	Sequence@@Table[cuboidIndexes[i], {i, 1, 8 m n p, 8}]]
	]
```

The resulting region can be used for computing:

```wl
In[4]:= HighlightMesh[CuboidVoidMesh[{5, 4, 3}], Style[2, Opacity[0.3]]]

Out[4]= [image]

In[5]:= RegionMeasure[%]

Out[5]= 112.5
```

---

Construct a cuboid boundary mesh with rectangular tunnels through it. You can construct it as the product of a 2D boundary mesh with an interval. Using the same construction as for constructing the polygon with holes above for the 2D boundary mesh:

```wl
In[1]:=
rectangleCoords[{i_, j_}] := rectangleCoords[{i, j}, {0.5, 0.5}];
rectangleCoords[{i_, j_}, {α_, β_}] := {{i - α / 2, j - β / 2}, {i + α / 2, j - β / 2}, {i + α / 2, j + β / 2}, {i - α / 2, j + β / 2}};

In[2]:= rectangleIndexes[i_] := Line[i - 1 + {1, 2, 3, 4, 1}];
```

The resulting boundary representation for a polygon with $m$×$n$ holes:

```wl
In[3]:=
RectangleHoleMesh[{m_, n_}] := 
	Module[{oc, hc}, 
	hc = Flatten[Table[rectangleCoords[{i, j}], {j, n}, {i, m}], 2];
	oc = {{0, 0}, {m + 1, 0}, {m + 1, n + 1}, {0, n + 1}};
	BoundaryMeshRegion[Join[hc, oc], 
	rectangleIndexes[4 m n + 1], 
	Sequence@@Table[rectangleIndexes[i], {i, 1, 4 m n, 4}]
	]
	]

In[4]:= RectangleHoleMesh[{4, 3}]

Out[4]= [image]
```

Compute the Cartesian product with an interval:

```wl
In[5]:=
TunnelMesh[{m_, n_}] := 
	BoundaryMesh[RegionProduct[TriangulateMesh[RectangleHoleMesh[{m, n}], MeshQualityGoal -> "Minimal"], MeshRegion[{{0}, {1}}, Line[{1, 2}]]]]

In[6]:= TunnelMesh[{4, 3}]

Out[6]= [image]
```

Style it so that you can only see the boundary surfaces:

```wl
In[7]:= HighlightMesh[%, {Style[1, None], Style[2, Opacity[0.5]]}]

Out[7]= [image]
```

You can still compute with this region:

```wl
In[8]:= NIntegrate[1, {x, y, z}∈%]

Out[8]= 17.
```

### Properties & Relations (8)

``BoundaryMeshRegion`` can represent full-dimensional regions:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]]

Out[1]= [image]
```

Since the geometric dimension is the embedding dimension, it is full dimensional:

```wl
In[2]:= {RegionEmbeddingDimension[ℛ], RegionDimension[ℛ]}

Out[2]= {2, 2}
```

---

``BoundaryMeshRegion`` is always bounded:

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]]

Out[1]= [image]
```

Use ``BoundedRegionQ`` to test and ``RegionBounds`` for actual bounds:

```wl
In[2]:= {BoundedRegionQ[ℛ], RegionBounds[ℛ]}

Out[2]= {True, {{0., 1.}, {0., 1.}}}
```

---

``BoundaryMeshRegionQ`` can be used to test whether a region is a ``BoundaryMeshRegion`` :

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]]

Out[1]= [image]

In[2]:= BoundaryMeshRegionQ[ℛ]

Out[2]= True
```

---

Use ``ConvexHullMesh`` to create a ``BoundaryMeshRegion`` from a set of points:

```wl
In[1]:=
p2 = RandomReal[1, {100, 2}];
p3 = RandomReal[1, {100, 3}];

In[2]:= ConvexHullMesh /@ {p2, p3}

Out[2]= {[image], [image]}
```

---

Use ``BoundaryMesh`` to convert a ``MeshRegion`` to a ``BoundaryMeshRegion`` :

```wl
In[1]:= mr = MeshRegion[{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {2, 0}}, {Triangle[{1, 2, 3}], Triangle[{4, 3, 2}], Line[{4, 5}]}]

Out[1]= [image]
```

Only the full-dimensional component can be represented:

```wl
In[2]:= BoundaryMesh[mr]
```

BoundaryMesh::brepl: There are components in  having dimension lower than the embedding dimension 2 that will not be included in the boundary representation.

```wl
Out[2]= [image]
```

---

Use ``BoundaryDiscretizeRegion`` to convert any region to a ``BoundaryMeshRegion``:

```wl
In[1]:= BoundaryDiscretizeRegion[ImplicitRegion[x ^ 2 + y ^ 2 ≤ 1 || y == 0, {x, y}]]
```

BoundaryDiscretizeRegion::brepl: There are components in ImplicitRegion[x^2+y^2<=1\|\|y==0,{x,y}] having dimension lower than the embedding dimension 2 that will not be included in the boundary representation.

```wl
Out[1]= [image]
```

To include lower-dimensional components, use ``DiscretizeRegion``:

```wl
In[2]:= DiscretizeRegion[ImplicitRegion[x ^ 2 + y ^ 2 ≤ 1 || y == 0, {x, y}], {{-2, 2}, {-1, 1}}]

Out[2]= [image]
```

---

Use ``Show`` to convert any ``BoundaryMeshRegion`` to ``Graphics`` :

```wl
In[1]:= ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]]

Out[1]= [image]

In[2]:= Show[ℛ]//InputForm
```

Out[2]//InputForm=
Graphics[GraphicsComplex[{{0., 0.}, {1., 0.}, {0., 1.}}, 
  {Directive[{Hue[0.6, 0.3, 0.95], EdgeForm[{Hue[0.6, 0.3, 0.75]}]}], 
   {Annotation[Polygon[{{1, 2, 3}}], "Geometry"]}}]]

---

``BoundaryMeshRegion`` is usually more memory efficient than ``MeshRegion``:

```wl
In[1]:= pts = RandomReal[{-1, 1}, {50, 2}];

In[2]:= {DelaunayMesh[pts], ConvexHullMesh[pts]}

Out[2]= {[image], [image]}

In[3]:= ByteCount /@ %

Out[3]= {7536, 1896}
```

## See Also

* [`MeshRegion`](https://reference.wolfram.com/language/ref/MeshRegion.en.md)
* [`BoundaryDiscretizeRegion`](https://reference.wolfram.com/language/ref/BoundaryDiscretizeRegion.en.md)
* [`BoundaryDiscretizeGraphics`](https://reference.wolfram.com/language/ref/BoundaryDiscretizeGraphics.en.md)
* [`ConvexHullMesh`](https://reference.wolfram.com/language/ref/ConvexHullMesh.en.md)
* [`BoundaryMesh`](https://reference.wolfram.com/language/ref/BoundaryMesh.en.md)
* [`FindMeshDefects`](https://reference.wolfram.com/language/ref/FindMeshDefects.en.md)
* [`BoundaryMeshRegionQ`](https://reference.wolfram.com/language/ref/BoundaryMeshRegionQ.en.md)
* [`MeshCellCount`](https://reference.wolfram.com/language/ref/MeshCellCount.en.md)
* [`MeshCoordinates`](https://reference.wolfram.com/language/ref/MeshCoordinates.en.md)
* [`MeshCells`](https://reference.wolfram.com/language/ref/MeshCells.en.md)
* [`MeshCellIndex`](https://reference.wolfram.com/language/ref/MeshCellIndex.en.md)
* [`MeshPrimitives`](https://reference.wolfram.com/language/ref/MeshPrimitives.en.md)
* [`Printout3D`](https://reference.wolfram.com/language/ref/Printout3D.en.md)
* [`3DS`](https://reference.wolfram.com/language/ref/format/3DS.en.md)
* [`BYU`](https://reference.wolfram.com/language/ref/format/BYU.en.md)
* [`X3D`](https://reference.wolfram.com/language/ref/format/X3D.en.md)

## Related Guides

* [Mesh-Based Geometric Regions](https://reference.wolfram.com/language/guide/MeshRegions.en.md)
* [Geometric Computation](https://reference.wolfram.com/language/guide/GeometricComputation.en.md)
* [Partial Differential Equations](https://reference.wolfram.com/language/guide/PDEModelingAndAnalysis.en.md)
* [`Polyhedra`](https://reference.wolfram.com/language/guide/Polyhedra.en.md)
* [3D Printing](https://reference.wolfram.com/language/guide/3DPrinting.en.md)

## Related Workflows

* [Make a 3D Printout](https://reference.wolfram.com/language/workflow/MakeA3DPrintout.en.md)

## History

* [Introduced in 2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) \| [Updated in 2015 (10.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn102.en.md)