How does Blender calculate path normals? In Blender, paths may be used to animate objects or to sweep surfaces. Both of these actions require that every point on the path has a normal. If this requirement were not fulfilled, the orientation of the object following the path would be ambiguous and the operations could not be completed.

Curves only have tangents and do not have intrinsic normals. Since normals are required, there must be an algorithm in Blender to generate them somehow. I only know of the following ways to generate normals for a curve:


Use the normal of the plane formed by the tangent and a fixed global axis. Fails when the curve runs parallel to this axis.
Use the normal of the average plane of the curve. Fails when the curve is a straight line.
Use a rail curve. This requires the user to define a second independent curve which never meets the first, and the normal is the line between the two curves.


Blender's path object does not fail when parallel to a global axis or when it's control vertices form a straight line. It also does not require a rail curve. How does it work?

I found this: http://wiki.blender.org/index.php/Dev:Ref/Requests/Incremental_curve_normals_proposal which present another possible solution, but it seems incomplete and may not reflect what Blender actually does at all. It does explain the problem in detail though.
In the Shape panel for Curve objects there are 3 twisting options:


Z-Up: uses Z axis to determine the twist.
Tangent: uses Frenet / Darboux frame tangent.
Minimum: step along the curve points, for each point computing a normal that is orthogonal to the curve direction and rotated as little as possible compared to the normal of the previous point.


Minimum is the default, and it behaves well in most cases. The downside is that it's non-local, any control point can influence the twist in the rest of the curve, but that's unavoidable, there is no other way to get minimal twisting.

The implementation in the Blender source code is in make_bevel_list_3D_minimum_twist.