I am new to the idea of topology data analysis, this is a figure in the paper: Persistent Homology Transform for Modeling Shapes and Surfaces, and I am wondering about how the distance matrix is generated:

My understanding of the distance matrix from the height function applied on the point cloud is as follows:
the point cloud forms sort of contour, and with the height function applied to it, the distance matrix would be the one shown on the right.

While I realized that if the distance matrix is generated in this way, then the adjacent relation between points is lost and makes the distance matrix from the opposite direction exactly the same...
Here they're instead doing sublevelset persistent homology. The direction of the blue arrow is the direction of a "height" function $f \colon M\to \mathbb{R}$, where $M$ is the red $M$ as drawn in the figure. So different blue arrow directions give different "height" functions. For each height function $f \colon M\to \mathbb{R}$ they consider the sublevelsets $f^{-1}((-\infty,r])$ containing all points in the red $M$ of height at most $r$. Note that for $r\le r'$, we have $f^{-1}((-\infty,r])\subseteq f^{-1}((-\infty,r'])$. Hence as $r$ increases, we get a filtration of $M$ by sublevelsets. This is called a sublevelset filtration. They are then plotting the persistent homology diagrams of these various sublevelset filtrations, for various choices of $f$ (as indicated by the blue arrows). So no distance matrices are involved here.