Anyone familiar with bezier/spline terminlology/

Started by
2 comments, last by JY 18 years, 5 months ago
There is a bezier curve library but the code in spline.C isn't well-enough documented for me to figure out what I need. Don't bother looking at all of it, a promising function is double spline_b_val(int ndata, double tdata[], double ydata[], double tval) which is// described:
Quote: The cubic B spline will approximate the data, but is not // designed to interpolate it. // // In effect, two "phantom" data values are appended to the data, // so that the spline will interpolate the first and last data values. // // Parameters: // // Input, int NDATA, the number of data values. // // Input, double TDATA[NDATA], the abscissas of the data. // // Input, double YDATA[NDATA], the data values. // // Input, double TVAL, a point at which the spline is to be evaluated. // // Output, double SPLINE_B_VAL, the value of the function at TVAL.
Now, in the test file spline_prb.C on the same page, it appears these "phantom" values are computed by the caller (test 13, line 2510) but I'm not sure if that's the same thing. Also, since TDATA are the x-coordinates, is TVAL an intermediate X-coordinate, or is it a measure of length from the first point? It makes all the difference if there are loops (there are in my data). The description "will approximate the data, but is not designed to interpolate it... the spline will interpolate the first and last data values" seems inconsistent. Can I have some help interpreting this please? What I have is a sequence of N (X,Y) coordinates approximating a curve. I want a new sequence of M (X,Y) coordinates approximating the same curve but with distances between points dictated by me. Typically N!=M Thanks
spraff.net: don't laugh, I'm still just starting...
Advertisement
Quote:Original post by walkingcarcass
Also, since TDATA are the x-coordinates, is TVAL an intermediate X-coordinate, or is it a measure of length from the first point? It makes all the difference if there are loops (there are in my data).

TDATA doesn't necessarily have to be the x-coordinate, it's just a set of values. More often than not it's time, and you have two B-splines, one for the X-axis and one for the Y-axis. Now you can parametrize a whole point (X,Y) as a function of a third variable (time) as opposed to just parameterizing Y as a function of X.

Quote:Original post by walkingcarcass
What I have is a sequence of N (X,Y) coordinates approximating a curve. I want a new sequence of M (X,Y) coordinates approximating the same curve but with distances between points dictated by me. Typically N!=M.

What you want to do is arc length parameterization (check out the first link, slide 17). I've also uploaded some notes I have on the subject here. It's a little tricky to understand at first, but not too difficult once you read through it a few times.
well, to be honest I can't make *much* of what you've pasted to your reply...
This is what I can tell you from the little experience I have with nurbs

1. 't' is the usual name for the parameter of splines, so I suppose that TVAL could hold the actual value of the parameter during evaluation. (like 'x' when you're evaluating f(x)) For the same reason I suppose TDATA is the knot vector, since it implies values for t. The knot vector is a predefined list of real numbers that define the interval in which the parameter 't' can vary, and -ultimately- the interval in which you'll be evaluating the nurb. The same curve can be produced for many different knot vectors.

2. YDATA... Since it is input data it can either be the set of control points or the influence weights for each control point. I agree it's not clear...

Quote:
Also, since TDATA are the x-coordinates, is TVAL an intermediate X-coordinate, or is it a measure of length from the first point? It makes all the difference if there are loops (there are in my data).

I have never come across any 'arc-length parametrizations' of NURBS. It's a very complex issue because of the very definition of NURBS curves. It has nothing to do with the simple definition of parametric curves as we know them (in which you can just find arc-length parameters by integration)
It should be possible though. I've just noticed that most people avoid to even touch this subject.


Quote:
The description "will approximate the data, but is not designed to interpolate it... the spline will interpolate the first and last data values" seems inconsistent.

No, I think this is the exact way to put it, because that's why Bezier and that other french mechanic "invented" NURBS in the first place. What you want from a NURBS curve, is to start at the first control point, end at the last one, and try to pass as close as possible near the intermediate points, depending on their assigned weight-values while maintaining the highest degree of continuity possible. "It interpolates the first and last, and approximates the rest" just like the comments in the snippet suggest.

I agree though, that this documentation is really vague!
I found this paper a great aid in understanding splines when I first looked at them:

http://www.intelligence.tuc.gr/~petrakis/courses/computervision/splines.pdf

Although I have to admit that it's the kind of thing that gets put in the "done that, trust it will always work" pile.
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan

This topic is closed to new replies.

Advertisement