[gameprogrammer] Re: curves

  • From: Robbert de Groot <zekaric@xxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Wed, 28 Jul 2004 12:30:17 -0400 (EDT)

I thing you are probably looking for something like a Catmul Rom Spline. 
very similar to Bezier splines.  Bezier splines use two control points
between two points.  Catmul Rom uses the points before and after the two
points and uses the vectors these points make with the two points making the
spline...  Got that?  :)  

[ASCII ART]
      . p1      .p3
       
          .p2      .p4

Bezier:

In bezier the spline will be made between p1 and p4 using p1->p2 as the
start direction at p1 and the vector p3->p4 as the end direction at p4.

Catmul Rom:

For Catmul Rom the spline will be made between p2 and p3 using the vector
p1->p3 for the start direction of the spline at p2 and p2->p4 for the end
direction of the spline at p3.      


So if you have a series of points you can create a spline from only the
control points with Catmul Rom and for the end points p1=p2 for the start
and p3=p4 for the end.  

Bezier formula is:
pointAtTime(t)= 
   (1 - t) ^ 3     *         p1 + 
   3 * (1 - t) ^ 2 * t     * p2 + 
   3 * (1 - t)     * t ^ 2 * p3 + 
                     t ^ 3 * p4
where t goes from 0 to 1.

From the two vectors in the Catmul Rom case you can find the two control
points for the bezier and use the formula.

There is actually a formula for Catmul Rom but I don't have the reference
with me handy.  The above is just what I remember so you may have to hunt
for more accuracy.


--- Norbert Felde <fenor@xxxxxxxxxxxx> wrote: > Hallo!
> 
> This topic is not direct connected with game programming, but I hope you 
> could help me or write where should I search or query for a solution.
> 
> The problem is:
> I need a curve that should go through at least 7 controll points, it 
> must not swing if more points are given and I should be able to 
> parametrize it with only one independent parameter.
> 
> curves I tried to use and why they do not answer the purpose:
> 
> Lagrange interpolation: it swings if more than 6-7 points are given.
> 
> Spline: it is composed of segments so there is no paramter that runs 
> over the entire curve.
> 
> Nurbs: It dous not run through the controll points. I think with 
> different knot functions it should go throught the points pat than it 
> must be composed of segments.


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: