# Last step of conversion from endpoint to center parameterization of an elliptical arc

I have implemented the conversion from endpoint to center parameterization of an elliptical arc following the instructions of the SVG spec at https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter.

However, while checking whether the implementation works correctly I found that

• if I create an arc in center parameterization,
• get the endpoints of that arc and
• use those endpoints together with the other needed parameters to create the same arc in endpoint parameterization

that the endpoints of this second arc don't coincide with the endpoints of the first.

Looking through my implementation it followed the spec of the SVG note exactly. However, if I change the last part where the start angle is calculated to

$$\theta_1 = \angle (\begin{pmatrix}1 \\ 0 \end{pmatrix}, \begin{pmatrix}x_1^\prime - c_x^\prime \\ y_1^\prime - c_y^\prime \end{pmatrix}$$

i.e. leaving out the division with $$r_x$$ and $$r_y$$ respectively, the endpoints coincide.

So my question is: Why is this division done if the endpoints are then wrong? Or am I missing something?

• The angle you get should be independent from the length of vectors. There must be something wrong in the way you compute the angle. Commented Oct 24, 2021 at 15:08
• @Intelligentipauca Yes, but I think this would only apply if each component of the vector was divided by the same amount, i.e. either $r_x$ or $r_y$? In this case the x-component is divided by $r_x$ and the y-component by $r_y$, so it would be a different direction. Commented Oct 24, 2021 at 17:36

An important (and potentially confusing) part of the center parameterization for elliptical arcs is that $$\theta_1$$ and $$\Delta\theta\$$ do not represent angles on the ellipse itself. Rather, these angles correspond to an unscaled, unrotated circle having the same center as the ellipse. Here is the crucial part of the spec you linked (emphasis mine):
If one thinks of an ellipse as a circle that has been stretched and then rotated, then $$\theta_1$$, $$\theta_2$$ and $$\Delta\theta$$ are the start angle, end angle and sweep angle, respectively of the arc prior to the stretch and rotate operations.
The approach you mention (omitting the division by these axis lengths) essentially "bakes" the ellipse scaling into the angle parameters. To see why this might be undesirable, consider how your parameters would change if you needed to, say, double the semi-major axis of the ellipse. In the circular model, only $$r_x$$ needs to be doubled. But if you've baked the scaling into your angle parameters, in most cases those would need to be recalculated as well.