Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rounding corners of a straight-edge path
#6
(05-27-2021, 05:37 PM)Ottia Tuota Wrote:
(05-27-2021, 05:24 PM)Ofnuts Wrote:
Quote:The algorithm to draw circular arcs is based on the well-known idea.

Is that the one that uses kappa=(4/3)*(sqrt(2)-1) (from memory)? The shallowness of the proof of that one has always intrigued me. But it does work with all angles...

Yes that is the one. I took that very formula and with some trigonometric manipulation changed it to suit my current purpose. Namely, I was drawing circular arcs without knowing the centers. But I had tangent triangles available. The code became pleasantly simple. You can find it in the plugin. Search for "def circlular_arc_in_tangent_triangle" (yes I notice now that there is a typo!). Note that I use the plane as the complex number plane. So, instead of [x,y] all points are complex numbers x+iy.

Edit: No, I said wrong. I did not take quite that formula but a more general one that works for circular arcs with central angle other than 90 degrees. The formula is: (4/3)*tan(theta/4) where theta is the central angle.

That's still the one I think; the value I mentioned is for theta=π/2. It is based on the assumption that the best Bezier approxmation is when the intersection of the Bezier curve and the bisector is on the true circle, but there are possibly better criteria, such as minimizing the area between the true circle and the curve. The main merit of that approximation is that it is easy to compute for all angles.
Reply


Messages In This Thread
RE: Rounding corners of a straight-edge path - by Ofnuts - 05-28-2021, 03:32 PM

Forum Jump: