Requesting Catmull Rom tutorial

BlitzMax Forums/BlitzMax Beginners Area/Requesting Catmull Rom tutorial

Matt McFarland(Posted 2005) [#1]
I'm very interested in learning the Catmull Rom. Although everywhere I go there seems to be too much info. If someone could just paste a code snippet of a 4 point catmull rom, I could probably pick it up from there and add it to my spline editor.

I'm very interested in learning the Catmull rom method. I've seen marvelous uses for it..

Look: http://www.mvps.org/directx/articles/catmull/

Look at that cool highway!!

There's so much you can do with it... This is a must learn for everyone! :)


ImaginaryHuman(Posted 2005) [#2]
Java code here:

http://www.cse.unsw.edu.au/~lambert/splines/


Matt McFarland(Posted 2005) [#3]
Thanks for that Angel, but I'm really looking for a BlitzMax demo that has the following:

one catmull rom spline with 4 points

0 and 4 are those one points that change the way it bends

1 and 2 are the control points

and thats it.. Like something that would be just a few lines of code and nothing extravagant like the spline demos out there. The problem with most spline demos is the programmer makes them so intricate and so advanced that a person like me wont understand the code unless it is studied for hours.

So again, if anybody out there hears my plea. I just ask that an expereinced programmer makes a short blitzmax spline demo with no bells or whistles, so that the basics of a cspline can be discovered.

That's all I am asking.. Just for a very very very BASIC cspline demo.. :)

Please someoen, please do this for the community. I promise I'll take your demo and add it into my spline editor, and I'll create a wonderful tutorial so that everyone can learn csplines without having to study for hours if not days!


Matt McFarland(Posted 2005) [#4]
Warpy saved the day again.. Man he's a great guy:

For t#=0 To 1 Step .01
   x#=.5*((2*p1.x)+(p2.x-p0.x)*t+(2*p0.x-5*p1.x+4*p2.x-p3.x)*t*t+(3*p1.x-p0.x-3*p2.x+p3.x)*t*t*t)
   y#=.5*((2*p1.y)+(p2.y-p0.y)*t+(2*p0.y-5*p1.y+4*p2.y-p3.y)*t*t+(3*p1.y-p0.y-3*p2.y+p3.y)*t*t*t)
   DrawRect x,y,1,1
Next


THIS is the Catmull Spline :)


Robert Cummings(Posted 2005) [#5]
Even I have warpycode (tm) somewhere.


Warpy(Posted 2005) [#6]
crikey, you do? That's amazing!

btw, the entirety of the little catmull rom demo I whipped up is at http://www.blitzbasic.com/codearcs/codearcs.php?code=1522
The rest of the bumf around it might give you some good ideas about how to use it for something useful :)


ImaginaryHuman(Posted 2006) [#7]
Here's an adapted version of this code wrapped into a little experimental program.




ImaginaryHuman(Posted 2006) [#8]
Just thought I'd post a similar demo using cubic bezier curves (4 points per curve), adapted from the bezier code by Wedoe.