0

How exactly can one calculate all required parameters for SVG path arc? Is there a source with a set of formulas somewhere available? A compendium without all the geometry background and without lengthly explanations?

I have been fiddeling with an online tool http://xahlee.info/js/svg_circle_arc.html but the resulting parameters seem to be all intervowen in some way.

For my specific application to draw an arc that has an appearence similar to the letter 'C', I exactly have four givens: The coordinates for the two ends of the arc, the height and the leftmost point:

Height: 29.0
Leftmost point: x=0 y=(29/2)=14.5
Upper end of the arc: x1=20 y1=6
Lower end of the arc: x2=22 y2=20

Now I want to write an absolute path:

<path d="M xx yy 
         A rx ry x-axis-rotation large-arc-flag sweep-flag x y"/>

This seems to be a hard task but I'm sure there is a way to derive everything from the givens.

jamacoe
  • 519
  • 4
  • 16
  • 1
    If you need an arc A you may try: `d =M${up.x},${up.y} A${r},${r} 0 0 0 ${down.x},${dovn.y}` where `r=height/2`. However. given the data you provide, I suspect you may need a different kind of curve – enxaneta Aug 27 '22 at 15:20
  • 1
    The [SVG specification describes how arcs work](https://www.w3.org/TR/SVG11/paths.html#PathDataEllipticalArcCommands) – Robert Longson Aug 27 '22 at 18:19
  • 2
    Your conditions have no analytical solution. "leftmost point at x = 0 and y = 14.5" implies `ry = 14.5` and `axis-rotation = 0` and leaves you with only `rx` as a choosable variable. I would suggest relaxing that to either "goes through point at x = 0 and y = 14.5" (but not guaranteed to be the leftmost point), or "leftmost point at x = 0" (but not guaranteed to be at y= 14.5). – ccprog Aug 28 '22 at 14:07
  • 1
    The answer to your questions in the first paragraph is "no", btw. You cannot expect to solve problems of analytical geometry without doing analytical geometry. Reformulate your your question in terms of geometry, and ask it at https://math.stackexchange.com/. – ccprog Aug 28 '22 at 14:18
  • @ccgprog true again. I just aimed to plug in numbers and move on, but now this function requires unexpected attention that I wasn't prepared to invest. Meanwhile I own it. – jamacoe Aug 28 '22 at 15:36

0 Answers0