2

I was wondering what would be the best and less complicated way of drawing a bezier curve in c++ with a set of points (roughly 100+ points) that are stored inside a vector From my understanding: -Bezier curves consist of 4 control points, the points in the middle dictate the direction/tangent of the curve

Would one possible method be to breakdown the points into different segments and from each segment determine the control points and tangents?

ixdlxi
  • 21
  • 1
  • 2

2 Answers2

1

It is called a cubic spline and if you search you might find some C++ code for it. I used the free Fortran code from Numerical Recipes Online and ported it to C# with no problems.

John Alexiou
  • 28,472
  • 11
  • 77
  • 133
0

Would one possible method be to breakdown the points into different segments and from each segment determine the control points and tangents?

Yes, basically one connects the line segments end-to-end such that the slope approaching the end of the line segment is equal on both sides of the connection point. This is called a cubic spline. You can find algorithms for this here.

ThomasMcLeod
  • 7,603
  • 4
  • 42
  • 80