PDA

View Full Version : Curves

Gavin
08-02-2001, 07:40 AM
My client wants a closed loop to be plotted on top of an image by adding 'control points' with the mouse. Have done a bezier with a start and finish at the same point ( to close the loop) and eac other click is a control point. But this isn't particularly good. Would prefer the loop to go through the points more like a nurbs curve. Any ideas, help pointers...

thanks gav

Rob The Bloke
08-02-2001, 04:00 PM
yup, Hermite curves.

Essentially they are the same as a bezier, but slightly different.

Q(t) = (2t^3 -3t^2 + 1)*P1 + (-2t^3 + 3t^2)*P4 + (t^3 - 2t^2 + t)*R1 + (t^3-t^2)*R4

Looks a bit sketchy, there are two control points P1 & P4, these can be the points put down with the mouse. R1 & R4 are tangents at the respective end-points. Theoretically you should be able to calculate the tangents fairly easily by averaging positions. R4 of curve segment 1 would be equal to (-R1) of curve segment 2.....

Another curve type well worth looking at would be Kochanek - Bartels Splines.

NURBS curves dont go through all of their control points.

Rob The Bloke
08-02-2001, 04:07 PM
http://www.gamasutra.com/features/20000530/sharp_02.htm

Gavin
08-03-2001, 02:29 AM
just being stupid about nurbs, I know what I meant just didn't convey it too well. Using the hermite curve with curve1_r4 == -curve2_r1

similar to using any curve with two endpoints (start/finish) and two control points which are connected/locked to the previous/next curves control points??

gav

Rob The Bloke
08-03-2001, 01:00 PM
Originally posted by Gavin:
similar to using any curve with two endpoints (start/finish) and two control points which are connected/locked to the previous/next curves control points??

yup, you just need to find the position of the 'invisable' control points. Using the Hermite would make it slightly easier I'd imagine....

Gavin
08-03-2001, 03:02 PM
cool, cheers