0

Say I have four points that define a Bézier curve. I'd like to implement a function in VC++ that would split this curve at a percentage X in order to generate the points for two new Bézier curves that, when drawn, would appear to exactly overlap the first curve. Can anyone provide code that does something like this?

Thanks for any help.

Regards, Kevin

Kevin
  • 403
  • 1
  • 8
  • 16

1 Answers1

0

There's Python code here.

Converting to C++ is very straightforward. I haven't tried the code myself, so I can't claim it's correct.

Community
  • 1
  • 1
arx
  • 16,686
  • 2
  • 44
  • 61
  • Thanks, that code gets me the points for the first curve, but it's not clear to me how to get the points for the second curve? – Kevin Jan 20 '12 at 19:58
  • 1
    Probably the simplest approach without any math is to reverse the points and call the function again, effectively working from the other end. e.g. If you want to split at 17%, call `sliceBezier(points,0.17)` and `reverse(sliceBezier(reverse(points),0.83))`. – arx Jan 20 '12 at 20:49