# NURBS Curves to Interpolate Points and Derivatives on a Surface of Revolution

## Problem in Prose

My starting point is a set of conic segments on a plane. Each of these conic segments interpolates between three points and known slopes on the two outer points.

I want to find a representation of these conics on a surface of revolution. The representation does not have to match the conics perfectly, but it must

• match the points and end slopes of the conic when projected on the surface without inflection points$^{(1)}$. I can generate an arbitrary amount of points along the curve, but I would like to keep it as simple as possible.
• match the surface of revolution in every point
• be a reasonable interpolant (see bottom)

If it helps, there would be some freedom in selecting the generating curve of the surface of revolution, but my understanding is that it must be a NURBS curve, because one possible interpolant would be the generating curve itself. It can be a special case, though. A third degree bezier curve would suffice.

I expect the interpolant I am looking for, if it exists, would be a rational bezier curve. But I may be mistaken, so I am stating the problem as the search for a general NURBS curve to fit the criteria.

I will try to express a version of the above in precise mathematical terms below.

(1) I am unsure about the precise definition of the term "inflection point" in this case (3-dimensional curve on a surface), and I welcome suggestions to improve this part of the question. Likewise, I recognize that there are also different ways to project points and slopes on the surface, again, hints as comments would be welcome. If slopes in the original curve could be preserved as angles relative to the $x$-$r$-plane at the point, it would be best.

## Problem in Mathematical Terms

Given a function $g:t \in \mathbb{R}\rightarrow (x_t,y_t) \in \mathbb{R}^2$, the generatrix of a surface of revolution, with the axis of revolution being the x-axis (if this is helpful, it can be assumed to be a third order non-rational bezier curve);

further, the basic definition of a NURBS curve $C$ of $p$-degree with $n$ control points $\overset\rightarrow P_i$ with the weights $w_i$ ($i=0..n$)

$$C(u)=\frac{\sum\limits_{i=0}\limits^{n}N_{i,p}(u)w_i \overset\rightarrow P_i} {\sum\limits_{i=0}\limits^{n}N_{i,p}(u)w_i}\\ C(u)=(C_x(u),C_y(u),C_z(u))$$

where $N_{i,p}(u)$ is the generating function of B-splines on a knot vector $\overset\rightarrow U$;

and further, the points $\overset\rightarrow K_0$, $\overset\rightarrow K_1$ and $\overset\rightarrow K_2$, which are on the surface. That is, for each point $\overset\rightarrow K=(K_x,K_y,K_z)$ there exists a $t$, so that $K_x=x_t$ and $\sqrt{K_y^2+K_z^2}=y_t$;

and lastly the derivatives $\overset\rightarrow K_0'$ and $\overset\rightarrow K_2'$.

I am looking for a knot vector $\overset\rightarrow U$, control points $\overset\rightarrow P_i$ and weights $w_i$ so that

$C(u_a)=\overset\rightarrow K_0$, $C(u_b)=\overset\rightarrow K_1$, $C(u_c)=\overset\rightarrow K_2$, with $(u_a,u_b,u_c)\in \mathbb{R}^3$

and

$\frac{C(u_a)'}{\left| C(u_a)'\right|} = \frac{\overset\rightarrow K_0'}{\left| \overset\rightarrow K_0'\right|}; \frac{C(u_c)'}{\left| C(u_c)'\right|} = \frac{\overset\rightarrow K_2'}{\left| \overset\rightarrow K_2'\right|}\\$ (The end derivatives match in direction)

and further $C(u)$ being on the surface of revolution (as defined above) for every $u \in [u_a, u_c]$.

I would like $C$ to be reasonable interpolant between the three points. For example, a sort of helix around the surface could fit the description above, but wouldn't help me. Bezier curves are said to be "variation diminishing" to express this idea, but I can't find a good analogue for this case.

Relevant literature:

Les Piegl and Wayne Tiller "The NURBS Book" (1997)

Robert Schaback "Planar Curve Interpolation by Piecewise Conics of Arbitrary Type" (1993)

• From the mathematical description, I have an impression that you don't know the curve's definition but would like to find one that interpolates the given input (3 points + 2 end slopes + lying on the surface). However, at the beginning of the post, you also mentioned you can generate "arbitrary amount of points along the curve", which suggests you already know the definition of the curve. So, which way is it? – fang Mar 31 '16 at 19:04
• @fang Thank you for your interest. I know one definition of a curve that would fit the problem, but it would be generating points and then deforming them in a step-by-step process, I need a NURBS representation. If that NURBS representation fits the idea behind the original curve, it doesn't necessarily need to fit the curve precisely. – RikkiTikkiTavi Apr 1 '16 at 0:54
• If there was a way to extend doi:10.1016/S0010-4485(03)00100-3 to rational b-splines, that would be perfect. – RikkiTikkiTavi Apr 1 '16 at 17:42
• Since the curve is always an approximation to the exact curve on surface, whether it is an integral B-spline or a rational one does not really matter that much. Why do you need it to be rational? – fang Apr 1 '16 at 17:48
• @RikkiTikkiTavi In a plane given 3 ptoins and another two with slopes, can you trace NURBS? – Narasimham Apr 1 '16 at 18:16

I'm not sure I understand the problem 100%, but here are some suggestions, anyway.

If you want an explicit NURBS representation of a curve that lies exactly on your surface of revolution, then the only option is a surface parameter space curve of the type mentioned by Fang.

So, take the data you want to fit, and map it back into a two-dimensional $uv$ space. Then, do whatever fitting you want to do in this space. This will give you curves $(u,v) = \big(u(t), v(t)\big)$ that match your data to the desired accuracy. In your fitting, you need to use polynomial or rational curves, and it would be best if the degree was pretty low. In fact, quadratic polynomials might be adequate.

Now, to get an explicit 3D NURBS curve, we need to form the composition of these $uv$ curves with the equation of the surface of revolution. So, suppose $S(u,v)$ is a rational parameterization of the surface of revolution. Then $t \mapsto S\big(u(t), v(t)\big)$ is a curve lying exactly on the surface of revolution that satisfies your constraints (if I understand them correctly).

Since this curve is a composition of rational functions, it is itself rational. There are a couple of ways to get the coefficients (i.e. the "control points") of this curve. One option is to fire up your favorite computer algebra system and just do the function compositions. Another way is to interpolate a suitably chosen set of points in 4D. If done correctly,the interpolation process will exactly reproduce the curve.

Actually, it looks like the composition mess is already worked out for you in this paper. and this one, and this one. The third one is the most recent, so it has the best references, and it's available on-line in PDF form.

If your surface of revolution (expressed in NURBS form) has degree $3 \times 2$, and your $uv$ curves are quadratic, then your final curve will have degree $3*2 + 2*2 = 10$. This is a bit high, but not too bad. And, if you want a NURBS curve that lies exactly on the surface, you have no choice.

The interpolation approach is probably the easiest to implement. Here's how you might approach it. If we regard the surface as a polynomial mapping from $[0,1] \times [0,1]$ to $\mathbb{R}^4$, then the composition curve $C(t) = S\big(u(t), v(t)\big)$ can be regarded as a polynomial mapping from $[0,1]$ to $\mathbb{R}^4$. If we use quadratic curves in $uv$ space, then as explained above, we know that $C$ has degree 10. So, take any 11 points on the curve, and interpolate them with a curve of degree 10, and you know that the curve you get will be exactly $C$, because this interpolation problem has a unique solution. So, take 11 parameter values $t_0, t_1, \ldots, t_{10} \in [0,1]$ and compute the ten points $Q_i = S\big(u(t_i), v(t_i)\big)$ for $i = 0,1, \ldots, 10$. Then find the control points of the unique curve $X$ of degree 10 such that $X(t_i) = Q_i$ for $i = 0,1, \ldots, 10$. You can find these control points just by solving a linear system -- easy. By uniqueness, $X$ must be the curve $C$ that we're seeking.

All of this reasoning applies only to a Bezier curve lying on a (rational) Bezier surface. If you want to deal with b-spline curves and surfaces, you first have to decompose them into their constituent Bezier pieces to do the interpolation calculations. Then, after you're all done, you can glue the Bezier curves back together to form NURBS curves, if you want to.

• You'll probably find other stuff if you search for "composition of NURBS functions" or "compositions of Bezier curves". I know Tony DeRose has done work in this area, for example. – bubba Apr 4 '16 at 14:44
• I think the third reference might be useful. You can convert to the scaled Bernstein basis, do the composition (which is easy in the scaled basis), then convert back to the standard Bernstein basis. The third paper is also useful for its newer references. – bubba Apr 5 '16 at 1:20
• Yes, I think the same idea would work with 4D coordinates. The benefit is not in execution speed, it's in code simplicity. – bubba Apr 5 '16 at 23:52
• After thinking about this a bit more, I think I'd recommend the interpolation approach. See additions to my answer. I have never actually tried this, so I'd be curious to know whether it works. I think it will, but you never really know until you do it. – bubba Apr 6 '16 at 13:29
• Correct. A single rational quadratic will work for anything strictly less than 180 degrees. But 120 degrees is a much safer limit. – bubba Apr 6 '16 at 13:54

Basically, you would like to find a NURBS curve that lies on a revolved surface and also interpolates 3 points on the surface and two end slopes. I would suggest the following approach:

1) Create a curve interpolating the 3 points and two end slopes. You can use whatever interpolation scheme you like as long as the curve is at least $G^1$ continuous.
2) Sample as many points as you need from the interpolating curve in step 1 and compute their normal projection onto the revolved surface.
3) Use constrained least square fitting to fit a NURBS curve from the projected points with the 3 points and end slopes as constraints.

Please note that the NURBS curve obtained will only lie close enough to the surface, instead of being exactly on the surface. But this is typically the case when you want to represent a surface parameter curve as a NURBS. (Note: a surface parameter curve means a curve lies exactly on a surface. Namely, $S_p(t)=S(u(t),v(t))$, where $S(u,v)$ is the surface)

• A NURBS curve that is not exactly on the surface is of no use to me, sorry. – RikkiTikkiTavi Apr 2 '16 at 23:38