Circular approximations using Bezier curves

I have 2 questions about Bezier curves and their use for approximating parts of circles.

  • Given the arc of the unit circle (1,0) β†’ (cos (a), sin (a)), where 0 <a <pi / 2, this will lead to a good approximation of this arc to find the control points of the bezier curve p1, p2, solving the equations imposed by the requirements B (1/3) = (cos (a / 3), sin (a / 3)), and B (2/3) = (cos (2a / 3), sin (2a / 3) ) (In other words, requiring the bezier curve to pass through two evenly spaced points in the arc).

  • If we have an affine transformation A that rotates an arc of a circle into an ellipse arc, the control points Ap0, Ap1, Ap2, Ap3 transform, determine a good approximation of the bezier to the ellipse arc?

p0 and p3, of course, are the starting and ending points of the curve: (1,0) and (cos (a), sin (a)).

thanks

+4
source share
2 answers

Here's a general solution for any elliptical arc like a cubic Bezier curve.

The error is most dependent on the difference between the initial and final angles. I had a good success by limiting the angle difference to 60 Β°. That is, I make a separate cubic segment for every 60 Β°; (or their fractions) and combine them together.

+3
source

Your questions are mainly asked "these are good approximations for the semicircle / arc of an ellipse."

You might want to try to calculate B_y(a) - sin(a) (of course, parameterizing your equations so that they end with (-1,0) with the same value a ) for your curve B(a) , in the graphics utility, such as Wolfram Alpha to display it, and see how variance is different and whether it is suitable for your purposes.

If you need a more accurate and non-visual answer, you can calculate

 Integral (from 0 to K) [B_y(a) - sin(a)]^2 da / 2 

Where K is the value of a , where both parameterized curves end with (-1,0) .

This integral is coupled / proportional (somewhat) to some degree of standard deviation and will serve well as a numerical analysis. If this is at your desired accuracy, you are good.

The second question, when you specify the affine transformation of a circle to an ellipse, will give you an error proportional to the original error if your transformation is essentially linear. If not, you can try using the Jacobian determinant of your transformation to see how the error changes.

I also found a nice Bezier semicircle approximation analysis , where the author finds a pretty sexual approximation

Bezier semicircle

Provided by:

  xValueInset = Diameter * 0.05
 yValueOffset = radius * 4.0 / 3.0

 P0 = (0,0)
 P1 = (xValueInset, yValueOffset)
 P2 = (Diameter - xValueInset, yValueOffset)
 P3 = (Diameter, 0)

Where P1 and P2 are your control points. Note that this approaches a semicircle:

 B(a) = [ (d/2)*cos(a)+d/2 , (d/2)*sin(a) ] 
+1
source

Source: https://habr.com/ru/post/1313562/


All Articles