O.K., if you need some math... Let's start. If an arc of a circle begins at 
point M1 (R 0) and goes up to point M4 (R*cos(f), R*sin(f)). If f<pi/2, you may 
use one cubic Bezier curve.  
Otherwise you should draw additional curves. You should find two control 
points: M2 and M3. M2 (R, h) and M3 (R*cos(f)+h*sin(f), R*sin(f)-h*cos(f)). 
Here you should calculated h. h=(4/3)*R*tg(f/4) or, what is the same, 
h=(4/3)*R*(1-cos(f/2))/sin(f/2). Assume, that angle f is positive, if goes 
counterclockwise. If you have an ellipse instead of a circle with x-axis rx and 
y-axis ry, you obtain such set of control points:

M1 (rx, 0);

M2 (rx, (4/3)*ry*tg(f/4));

M3 (rx*(cos(f)+(4/3)*sin(f)*tg(f/4)), ry*(sin(f)- (4/3)*cos(f)*tg(f/4)));

M4 (rx*cos(f), ry*(sin(f));

All coordinates here are absolute. Center of this ellipse is at (0, 0).

I hope, you can shift and rotate it yourself? Here is only school math.

Andrew M.





  ----- Original Message ----- 
  From: Joe Gammad 
  To: [email protected] 
  Sent: Sunday, April 10, 2005 10:28 AM
  Subject: [svg-developers] Convert Ellipse to Cubic Bezier



  I have been struggling with this problem for some time
  and have not yet found an answer.  Basically I want to
  convert a path containing an "elliptical arc curve"
  command to a "cubic bezier curve" command like so:

  Convert this:

  M (x y) A (rx ry rotation large-arc-flag sweep-flag x
  y)


  To this:

  M (x y) C (x1 y1 x2 y2 x y)

  This may seem like a backwards thing to do, but please
  just humor me.  I don't want to get into the details
  as to why I want to carry this conversion out.  I just
  do.  Also I am sure there are parsers or conversion
  utility programs out there, however I would like to
  know how this can be done mathematically (i.e. with a
  paper and pencil and calculator).  One wrinkle I see
  is that if the large-arc-flag is 1, then two or three
  cubic bezier commands (C) may be required to describe
  the path.

  There have been a number of questions in this forum
  regarding ellipses, so the solution to this problem
  may be of interest to other people as well.

  Any advice or help you can give me would be GREATLY
  appreciated.

  Thanks,

  Joe




              
  __________________________________ 
  Do you Yahoo!? 
  Yahoo! Small Business - Try our new resources site!
  http://smallbusiness.yahoo.com/resources/


  -----
  To unsubscribe send a message to: [EMAIL PROTECTED]
  -or-
  visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
  ---- 



------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 




[Non-text portions of this message have been removed]



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to