Given n points:
p0, p1, p2, ..., pn;
How can I get the point c1, c2 so that the cubic bezier curve defined by
p0, c1, c2, pn
closest to the g
You might want to have a look at this page : http://www.antigrain.com/research/bezier_interpolation/index.html
It's a very good implementation, though as the author writes : "This method is pure heuristic and empiric. It probably gives a wrong result from the point of view of strict mathematical modeling. But in practice the result is good enough and it requires absolute minimum of calculations. "
It's in C++ but is really easily portable to any language... Pass each of your "edges" through the control points calculation function, then through the bezier calculation one, and you have it. To perform bezier smooth on a polygon, pass a last edge with your last and first point.
