---
title: Convex Hull
tags:
  - authorship/other-for-now
  - type/encyclopedia-entry
---
# Convex Hull

In [[geometry]],
the **convex hull** of a shape
(also **convex envelope** or **convex closure**)
is the smallest [convex set](https://en.wikipedia.org/wiki/Convex_set "Convex set")
that contains it.[^1]

[^1]: [Wikipedia](https://en.wikipedia.org/wiki/Convex_hull)

```tikz
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    axis equal,
    xmin=0, xmax=3.5,
    ymin=0, ymax=3.4,
    grid=both,
    xlabel={$x$}, ylabel={$y$},
    tick style={black!60},
    title={Convex Hull of a Point Set}
  ]
    % Point cloud
    \addplot[
      only marks,
      mark=*,
      mark size=1.8pt
    ] coordinates {
      (0.5,0.5)
      (1.0,2.0)
      (2.0,1.0)
      (2.5,2.2)
      (3.0,0.5)
      (1.8,3.0)
      (0.2,2.5)
      (3.2,1.5)
    };

    % Convex hull (listed in counterclockwise order)
    \addplot[
      thick,
      fill opacity=0.15,
      fill=blue
    ] coordinates {
      (0.5,0.5)
      (3.0,0.5)
      (3.2,1.5)
      (1.8,3.0)
      (0.2,2.5)
    } -- cycle;

    % label hull vertices
    \addplot[only marks, mark=*, mark size=2.2pt] coordinates {
      (0.5,0.5)
      (3.0,0.5)
      (3.2,1.5)
      (1.8,3.0)
      (0.2,2.5)
    };
    \node[anchor=north west] at (axis cs:0.5,0.5) {$H_1$};
    \node[anchor=north east] at (axis cs:3.0,0.5) {$H_2$};
    \node[anchor=west]       at (axis cs:3.2,1.5) {$H_3$};
    \node[anchor=south]      at (axis cs:1.8,3.0) {$H_4$};
    \node[anchor=east]       at (axis cs:0.2,2.5) {$H_5$};
  \end{axis}
\end{tikzpicture}
\end{document}

```
