CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    10

    Exclamation urgent: bezier curves

    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!

  2. #2
    Join Date
    Sep 2004
    Location
    Sandhem, Sweden
    Posts
    20

    Re: urgent: bezier curves

    Hi..

    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, B, C and D are the control points.
    '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:
    Code:
    Z(a) = Az·a³ + Bz·3·a²·b + Cz·3·a·b² + Dz·b³
    Hope this helps.

    Regards,
    Michael

  3. #3
    Join Date
    Jun 2004
    Posts
    10

    Thumbs up Re: urgent: bezier curves

    thanks a lot! exactly what i wanted!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured