#!/usr/bin/env python # coding: utf-8 # ## Plotly Alpha Shapes as Mesh3d instances ## # Starting with a finite set of 3D points, Plotly can generate a [`Mesh3d`](https://plot.ly/python/reference/#mesh3d) object, that depending on a key value can be the convex hull of that set, its Delaunay triangulation or an alpha set. # This notebook is devoted to the presentation of the alpha shape as a computational geometric object, its interpretation, and visualization with Plotly. # # Alpha shape of a finite point set $S$ is a [polytope](https://en.wikipedia.org/wiki/Polytope) whose structure depends only on the set $S$ and a parameter $\alpha$. # # Although it is less known in comparison to other computational geometric objects, it has been used in many practical applications in pattern recognition, surface reconstruction, molecular structure modeling, porous media, astrophysics. # In order to understand how the algorithm underlying `Mesh3d` works, we present shortly a few notions of Computational Geometry. # ### Simplicial complexes and Delaunay triangulation ### # Let S be a finite set of 2D or 3D points. A point is called $0$-simplex or vertex. The [convex hull](https://en.wikipedia.org/wiki/Convex_hull) of: # - two distinct points is a 1-simplex or edge; # - three non-colinear points is a 2-simplex or triangle; # - four non-coplanar points in $\mathbb{R}^3$ is a 3-simplex or tetrahedron; # In[1]: from IPython.display import IFrame IFrame('https://plot.ly/~empet/13475/', width=800, height=350) # If $T$ is the set of points defining a $k$-simplex, then any proper subset of $T$ defines an $\ell$-simplex, $\ell