Files
zmVault/convex-hull.md
T

80 lines
1.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id:
aliases: []
tags:
- authorship/other-for-now
- topic/math
- type/encyclopedia-entry
title: Convex Hull
dg-publish: true
---
# Convex Hull
> [!quote] [Wikipedia](https://en.wikipedia.org/wiki/Convex_hull)
> the **convex hull**, **convex envelope** or **convex closure** of a shape
> is the smallest [convex set](https://en.wikipedia.org/wiki/Convex_set "Convex set")
> that contains it.
```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}
```