Mesh topology and differential geometry
The last week was busy, and I decided to spend my shortened free time to revisit differential geometry. Application of differential and integral calculus to geometry problems.
I got motivated about differential geometry when I found how it was used in the spiro splines of inkscape. It led me to learn lot of mathematics that I wouldn't have otherwise studied in such detail.
For a while I've been anticipating there's a very strong correlation between the differential geometry and how skilled 3D modelers arrange a polygon model.
Curvature of surfaces
Many real-world surfaces are smooth. They contain curves, bumps and slopes.
There is a mathematical foundation for analysing curved surfaces. Curvature. The concept is fairly easy to grasp.
If you have a curve that forms a circle, it has a constant curvature that is the inverse of its radius. For example, a circle of 10mm radius has 0.1mm curvature. A line has a curvature of 0mm. If you allow the curvature to change across the curve, you have a spline.
Curvature is a strictly local measure of a curve. If you take an integral of the curvature map then you get the total curvature that represents how many radians the curve turns along the path.
The same concepts can be applied to describe the curvature of a surface. Lets start with this fragment of a torus:
For a curve the curvature map gives the curvature. Curvature map of a surface requires that you know the highest and lowest curvature at each point of the surface.
The highest and lowest curvatures are called the principal curvatures of the point on a surface.
The principal curvatures can be divided into extrinsic and intrinsic measures that reveal qualities from the surface:
K = k[max] * k[min]
H = (k[max] + k[min]) / 2
K is intrinsic measure of curvature. It is called the
H is extrinsic measure and is called the mean curvature.
It is the average of the maximum and minimum curvature after all.
Both measures reveal interesting properties of the surfaces. For example, if the H = 0 across the surface, you have a minimal surface. Soap films take shape of minimal surfaces if they can.
If the K = 0 across the surface, you have a developable surface. Cylinders, cones, planes take the form of a developable surface. You can cut developable surfaces from cones and planes.
Different surface shapes have different intrinsic and extrinsic curvature plots and they can be named:
If you integrate a gaussian curvature map of a surface, you get the total curvature of the surface.
If you form a geodesic triangle to the surface, then you can calculate the total curvature of that triangle and it equals the deviation of the angles of the triangle on a flat surface.
Angles of a triangle on a flat surface equal π. If the shape inside the triangle has positive total curvature then the angles exceed π. On negative total curvature the angles of the triangle are less than π.
Remember that for the above rule to hold the edges of the triangle must be geodesic to the surface.
The topology of the surface is connected to the total curvature.
Likewise the curvature itself has a fairly nice analogy called angular defect. Knowing this helps if you are constructing platonic solids, for example.
Geodesic represent a straight path along the surface. At every point of the curve the geodesic curvature must be zero. Eg. The tangent of a curve must not rotate around the surface normal.
Geodesic curvature, normal curvature and relative torsion together form a Darboux frame.
First fundamental form
Differential geometry provides the framework to calculate areas and distances. This happens through the inner and outer product of the tangent spaces.
ds² = E*du² + 2F*du*dv + G*dv²
dA = sqrt(E*G - F²)*du*dv
E = dot(Xu, Xu), F = dot(Xu, Xv), G = dot(Xv, Xv)
If you are curious how this is derived, the first fundamental form gets derived from the following equations:
p = P(u, v), u = u(t), v = v(t)
ds² = dot(p', p')
p' = Pu * du + Pv * dv
The results are obtained by some rewriting. The dot product, when used like this, is behaving like a quadratic clause.
To differentiate by
t, we take a total derivative from the
The area equation is calculated from this directly by using a lagrange's identity:
dA = length(cross(Xu*du, Xv*dv))
dA = length(cross(Xu, Xv)) * du * dv
The definition of the cross product allows the multipliers to be thrown outside.
Second fundamental form and gaussian curvature
These are here as a reference for myself:
L*du² + 2M*du*dv + N*dv²
K = (LN - M²) / (EG - F²)
H = 0.5 * (LG + NE - 2MF) / (EG - F²)
L = dot(Xuu, n), M = dot(Xuv, n), N = dot(Xvv, n)
n = normalize(cross(Xu, Xv))
I still do not entirely understand this second fundamental form, but with the first fundamental form it reveals the curvature parameters and I like that.
To organize the model, it is common that the modeller forms it from the quad loops. The quad loops cross across the model to every direction.
The density of the quad strips depend on the amount of detail on the surface. Commonly these strips have to cross each other. In that case one or more of the vertices have to behave as poles.
Pole is a vertex that has less or more than 4 edges connected to it. This causes the quad flows to rotate around the pole!
Poles are usually not liked because they get too easily visible in the model. It appears that the places where the poles do not harm are umbilic points on the surface. That is, the pole should appear in points where the surface curvature is isotropic.
Also lets consider the meshes themselves. When joining two meshes we have two constraints: The meshes must be of same density at the edge, and the densities must appear at the roughly the same sides.
Overall we can see that the understanding of the curvature on surfaces allows us to connect the mathematical theory of topology and apply it to the topology of polygonal meshes.