1

I need to programatically generate two-dimensional circles of various dimensions, knowing only their radius and position. The circles will be drawn by employing 4 cubic Bezier curves. How should I calculate the Cartesian coordinates of the two intermediary control points of each arc?

A Dwarf
  • 113

1 Answers1

2

Wikipedia has it all worked out.

The control points between $(1,0)$ and $(0,1)$ are at $(1,k)$ and $(k,1)$ with $k=\frac43(\sqrt2-1)$.

joriki
  • 238,052
  • Thank you, joriki. For some reason missed the article Bezier Splines. I can see it now linked at the bottom of the Bezier Curves article where this very matter is being discussed. – A Dwarf Oct 25 '12 at 22:59
  • @ADwarf: You're welcome! – joriki Oct 25 '12 at 23:01
  • @joriki I've been working on this for three days, wrestling binomial coefficients, Bernstein Basis Polynomials and Catmull-Rom splines, but for a programmer like me the math talk is just too dense. I know that k is something like 0.55. Now (1,k) and (k,1) appear to be coordinates in this answer, but they're actually closed intervals, right? So how do I calculate control points p1 and p2, given begin and end coordinates p0(50,50) and p3(250,50)? – Elise van Looij Jul 09 '16 at 09:47
  • @ElisevanLooij: No, they're coordinates. Your $p_0$ and $p_3$ don't define a unique arc; even if I assume that you want a quarter-circle, there are two different quarter-circles with those two endpoints. Find a linear transformation that maps the quarter-circle about the origin through $(1,0)$ and $(0,1)$ to the quarter-circle you want, then apply that transformation to $(1,k)$ and $(k,1)$ to get the control points. – joriki Jul 09 '16 at 10:38