0

I would like to know whether there exists such an algorithm to fit Bezier curves of degree at most 3 to a given path. The path represents a set of 2D points connected to each other.(piecewise linear). The problem is to perfectly fit(going through all the points) as less Bezier curves(at most degree 3) as possible. Thanks in advance.

  • There are algoritms to interpolate n points with n-1 cubic splines. Then it is possible to change polynomial spline basis to Bernstein polynomial basis to create Bezier curves. Or you want to use less than n-1 curves? – MBo Jun 22 '23 at 15:21
  • The idea is to use as less Bezier curves as possible. – Erik Nouroyan Jun 22 '23 at 16:23
  • Why not B-splines? – Jean-Baptiste Yunès Jun 23 '23 at 10:44
  • will it be possible with B-splines? – Erik Nouroyan Jun 23 '23 at 10:58
  • do you want "one curve through all points" (in which case you can only have up to 4 points) or "one or more cubic curves that all join up to go through however many points I have"? – Mike 'Pomax' Kamermans Jun 23 '23 at 16:02
  • The less the curves the better. If it's possible to fit one cubic curve passing through all the points it will be just great. – Erik Nouroyan Jun 23 '23 at 18:56
  • I think the best you can hope for is [two points per curve](https://i.stack.imgur.com/Cmktz.png). That's because the [control points associated with two connected curves](https://i.stack.imgur.com/KxqOn.png) must leave the shared endpoint in opposite directions. So the direction is a compromise that works best for both curves, and the only real adjustment is the distance from the endpoint to the control point. – user3386109 Jun 24 '23 at 02:46
  • The question is what you're trying to do: are you trying to trace an outline? (in that case, have a look at potrace). Are you trying to fit a curve to data? (in which case, this is going to overfit and would be _terrible_ data science =). What's the use case you're trying to apply curve fitting? – Mike 'Pomax' Kamermans Jul 19 '23 at 18:36

0 Answers0