[gameprogrammer] Re: curves

  • From: Norbert Felde <fenor@xxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Thu, 29 Jul 2004 10:17:55 +0200

Hallo,

If I use Catmull Rom spline I need a t parameter going 0-1 between every 
four controll points, so the whole curve is composed of more segments.
It is important that I should be able to go through the whole curve with 
   a paramter which is 0 at the start and 1 at the end of the curve 
because I want to use equal length parts of the curve.
What I mean:
If I use the values 0, 0.25, 0.5, 0.75 and 1 of t than I get everytime 
equal length lines between the different t values. ( 0 and 0.25, 0.25 
and 0.5, ... )

Is there a method how I can get control points from Catmull Rom spline 
for a NURBS?

Thanks,
Norbert

Robbert de Groot wrote:
> 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
> 
> 
> 




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


Other related posts: