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?
Calculate intermediary control points in Cubic Bezier Curves
1
$\begingroup$
bezier-curve
1 Answers
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)$.
-
0Thank 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. – 2012-10-25
-
0@ADwarf: You're welcome! – 2012-10-25
-
0@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)? – 2016-07-09
-
0@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. – 2016-07-09