hi guys!
is there a way to draw bezier curves without using the GDI functions? like, drawing the curve as connected lines? i've already got the four control points for the curves.. is there any way to do that? like a formula? thanks! :confused:
Printable View
hi guys!
is there a way to draw bezier curves without using the GDI functions? like, drawing the curve as connected lines? i've already got the four control points for the curves.. is there any way to do that? like a formula? thanks! :confused:
Hi..
A, B, C and D are the control points.Code:X(a) = Ax·a³ + Bx·3·a²·b + Cx·3·a·b² + Dx·b³
Y(a) = Ay·a³ + By·3·a²·b + Cy·3·a·b² + Dy·b³
'a' is a value from 0 to 1.
b=1-a
For example, if you want 5 straight lines representing your curve you step 'a' from 0 to 1 by 0.2.
If you need a 3rd dimension, it's very easy. Just add the following line:
Hope this helps.Code:Z(a) = Az·a³ + Bz·3·a²·b + Cz·3·a·b² + Dz·b³
Regards,
Michael
thanks a lot! exactly what i wanted! :D