Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a B-Spline curve. I have all the knots, and the x,y coordinates of the Control Points.

I need to convert the B-Spline curve into Bezier curves.

My end goal is to be able to draw the shape on an html5 canvas element. The B-Spline is coming from a dxf file which doesn't support Beziers, while a canvas only supports Beziers.

I've found several articles which attempt to explain the process, however they are quite a bit over my head and really seem to be very theory intensive. I really need an example or step by step help.

Here's what I've found: (Explains B-Splines), (Convert B-Splines),

I can share my Nodes or Control Points if that would be useful. If someone would point me to a step-by-step procedure or help me with some psuedo(or actual)code, I would be so grateful.

share|improve this question
add comment

1 Answer

What you need is something called "Boehm's algorithm" (after its originator, Wolfgang Boehm). It has a simple geometric interpretation, and drawing a few pictures should make it clear. There is a pretty good explanation (with pictures) in this document.

The algorithm is based on a process called "knot insertion". You keep inserting knots into the b-spline curve until each knot has multiplicity 3. Then, the b-spline control points of this refined curve give you the Bezier control points of its segments.

So, if you're writing code to do this, one approach is to write a knot insertion function first, and then call it repeatedly.

There is knot insertion code here.

share|improve this answer
    
Thanks, yeah I had seen that article. I'm having a hard time making sense of the math and creating javascript from it. I need an example that is less theory and more application. (Or better math skills). –  TimSum Jun 18 '13 at 15:13
    
Now that I've told you the name of the algorithm (Boehm or Bohm), I was thinking you could search for code. I assume that your curve is cubic (degree = 3)? Are your knots uniformly spaced? –  bubba Jun 18 '13 at 15:44
    
Sorry -- one more question: are there any repetitions in your sequence of knots? –  bubba Jun 18 '13 at 15:46
    
I'll continue to search for code. My curve is cubic. Knots are not evenly spaced and there are repetitions. –  TimSum Jun 18 '13 at 20:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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