Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
up vote 2 down vote accepted

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)$.

share|cite|improve this answer
    
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 9 at 9: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 9 at 10:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.