Jump to content
  • Advertisement
Sign in to follow this  
xargon123

Converting a b-spline curve to a catmull rom spline

This topic is 3754 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I have a b spline that is represented by 30 control points and I want to convert it to equivalant catmull rom spline with the same number of control points. What is the best way that I can achieve this. I know I must invert the Catmull rom spline basis matrix and multiply it with the bezier basis matrix but is there a way to transform all the control points in one sweep? The basis matrix would be 4 X 4, and my control point vector has 30 elements. So, how is this supposed to work? Cheers, xarg [Edited by - xargon123 on July 6, 2008 3:35:42 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hello,

A bit more detail:
It seems it should be as follows (found it after googling):

T x B1 x G1 = T X B2 x G2

G1 = B1'x B2 x G2

B1 = Basis matrix for spline 1.
B2 = Basis matrix for spline 2.
G1 = control points for spline 1.
G2 = control points for spline 2.

So, do I transform each of the conrol points according to this equation. So, if I have 100 control points, I should loop over them and transform each of them separately according to this equation? Also, what if my control points are 2D, should I pad them with 2 0s to make them a 4D point considering that the multiplying matrix would be 4 x 4?

Many thanks.

Cheers,
xarg

Share this post


Link to post
Share on other sites
A Bezier curve with 30 control points is described by a 29th-order polynomial, and cannot be described (except in ridiculously degenerate cases) by a cubic spline such as a Catmull-Rom spline. The best you'd be able to do would be approximating it. Are you sure you actually have a Bezier curve, rather than a B-spline?

Share this post


Link to post
Share on other sites
Catmull-Rom splines are just C1 continuous bezier curves, hence bezier-splines(not the same as bspline!!)

If you have a bspline, you can convert it to a bezier-spline by inserting the knots repeatedly to get multiplicity n for inner knots and on the borders you need to clamp the bspline to get endpoint interpolation.

If n is your degree and the knot vector is [t0,...tn+m]
you need to insert tn and tm up to multiplicity n+1
(called clamping)

Use the algorithm of Boehm to insert knots.
Note(detail of the boehm algorithm):
Inserting tm is valid in this case, because the linear weight for the right side of the last control point is zero.


Your knot vector should look like this(n=3):
[t0,...,t2,tn,tn,tn,tn,tn+1,tn+1,tn+1,...,tm,tm,tm,tm,tm+1,..,tm+n]

You can remove the last and first n control points & knots, since these are not part of the curve.

Note: for a parameter u < tn or u > tm the sum of the bspline basis functions is <1.0, thus these segments can be removed, since it is stated, that the basis functions need to be a convex combination (sum = 1.0)

You will have a knot vector like this now(n=3):
[00001112223333]
each interval [0,1][1,2][2,3] is now a degree 3 bezier curve.
An you got your bezier-spline/catmull-rom-spline


I hope that helps, I'll check this thread if you have further questions.

P.S.: "The Nurbs Book" is a pretty interesting read for this kind of work.

Share this post


Link to post
Share on other sites
Hello,

Thanks for your reply. I guess I started the post wrongly and confused everyone.

So, what I have is a set of uniform data points and I have fitted a b-spline to it in the least square sense. Now, for rendering I want to use a Catmull Rom spline as they have the nice property that the spline passes through the control points.

I had googled and found pages like this that described this simple matrix inversion and multiplication with the other spline basis function to transform the control points:

One example is here:
http://groups.csail.mit.edu/graphics/classes/6.837/F04/assignments/assignment8/>

http://www.cs.virginia.edu/~gfx/Courses/2002/Intro.fall.02/Lectures/lecture23.ppt (Slide 32, for example).

So, I thought it would be something simple as they have described. Unfortunately, I do not quite understand the solution that you prescribed but will try and figure it out.

Please do post any suggestions you have. I would be really grateful as I am struggling quite a bit with this! My whole weekend has vanished!

Cheers,
xarg

[Edited by - xargon123 on July 6, 2008 6:03:40 AM]

Share this post


Link to post
Share on other sites
if you have a knot vector, pick a knot and insert it up to multiplicity n, then the curves will go through through the corresponding control point. So the segment defined by an interval is just a bezier curve of the same degree as your bspline.

Lookup "bsplines multiple knots"

Here is a graphical illustration of the influence of knots insertions, look at picture e) the spike is 1.0, thus the curve goes through the control point.

http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-property.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!