I'm curious as to what the tangent direction here is?
@adilets Good question. A tangent direction is any direction orthogonal to the surface normal at the vertex. The vertex normal in turn has many possible definitions. Two that work quite well are: the area-weighted average of all adjacent triangle normals, or the angle-weighted average (using the interior angles at the vertex as weights). Chapter 5 of my course notes on discrete differential geometry explore the choice of vertex normal in greater detail.
How do you choose which order to center the vertices in?
@tcl1 Good question. There are many ways to order iterative updates, and some may converge faster than others (or even produce different results). In this setting, a good way to do it is: update them all at the same time. In other words, first compute all the averages, then replace the positions with their averages. This scheme is independent of any ordering. Note that you can't do this "in place"; you have to store the locations and averages separately.