Given a set of vertices, transforming them to fit onto some spline curve. For example 3D modelling software has extrude along curve and Unreal Engine has a spline mesh component that takes some mesh and stretches it along a defined curve.

Is there some branch of mathematics or theory that looks into this?

  • 1
    $\begingroup$ Many animation tools have such functions, such as mayas curve deformer. But thenagain your question is a bit vague in terms of what you want as you may in fact want to know about spline patches such as nurbs surfaces that indeed have a quite wide mathematical research behind them. $\endgroup$
    – joojaa
    Jul 6, 2016 at 6:50

1 Answer 1


I have no knowledge of the literature on the topic, but I did something very similar to what you're asking some time ago: I wanted to generate lathe meshes and bend them according to a spline. I think the same technique could be adapted to your case quite easily.

First you would need to define what your default axis is: if the input mesh corresponds to the case when the spline curve is a straight line, where is that line in 3D? It could be defined arbitrarily as the Y axis, the PCA of the mesh, or some manually defined axis.

The algorithm is then:

for each vertex v
    matrix4 M = ComputeTransformFromAxisToSpline(v);
    v = ApplyTransform(v, M);

The tricky part is obviously to define a transform $M$. You could do something like:

matrix4 ComputeTransformFromAxisToSpline(vector3 v)
    float h = GetPositionOnAxis(v, originalAxis);
    vector3 p1 = GetPointOnSpline(h);
    vector3 p2 = GetPointOnSpline(h + dh); // dh is a small delta
    vector3 u = normalize(p2 - p1);

    // Define an orthogonal basis
    vector3 v = v0;
    vector3 w = normalize(cross(u, v));
    vector3 v = normalize(cross(w, u));

    return MakeTransform(u, v, w, p1) * MakeTranslation(originalAxis, -h);

$v_0$ is going to be the problem. I have tried two approaches:

  • Use an absolute value, like an axis orthogonal to the default axis. This will work only if the spline never gets parallel to that axis. It may also lead to undesired shapes.
  • Start with an absolute value for the points at $h=0$, then reuse the previous $v$ for bigger $h$ values. This means you have to treat vertices ordered by $h$. In my case this was trivial because I was generating the vertices, but in your case that would probably mean to sort them. The result is a mesh that will tend to twist in curves, which may or may not be desirable.

Another possibility would be to define the orientation by having more information in the curve, but I haven't tried that approach as I was already satisfied with the result.

  • $\begingroup$ There is a less understood trick to handle the flip of the spline direction, it happens because you use a naive local approach to the problem. But it is quite easy to find all the locations where the flip will occour than its just a matter of saying okay this segment is reversed. $\endgroup$
    – joojaa
    Jul 7, 2016 at 9:08
  • $\begingroup$ Interesting. In my case the flip was never a problem though. I had to handle the case when the spline was backtracking, but that was easy to detect and then just a matter of switching a sign. $\endgroup$ Jul 7, 2016 at 9:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.