## Circular arcs 3 - parameterization

In the last article, we discussed how to compute a point on the arc given a parameter value. In this article, we explore the inverse problem of computing the parameter value given a point (approximately) on the arc. Parameters used for arc evaluation and parameterization.

To recap, we obtained the following results for evaluation:

$$X(s) - M = \begin{bmatrix} g\left(\chi_s^2 - \chi_c^2\right) & \left(1+g^2\right) \chi_s\chi_c \\ -\left(1+g^2\right) \chi_s\chi_c & g\left(\chi_s^2 - \chi_c^2\right) \end{bmatrix} h^\perp$$
$$\chi_c = \cos\frac{\sigma\theta}{2} \qquad \chi_s = \frac{1}{g}\sin\frac{\sigma\theta}{2}$$

We will now define the matrix elements to be

$$p = g\left(\chi_s^2 - \chi_c^2\right) \qquad q = \left(1+g^2\right) \chi_s\chi_c$$

The first step to invert this is to reformulate the linear system to make $$p$$ and $$q$$ the variables and solve for them:

$$\begin{bmatrix} p\\q \end{bmatrix} = \begin{bmatrix} h^\perp & h \end{bmatrix}^{-1} \left(X-M\right) = \frac{1}{\left\lVert h \right\rVert^2} \begin{bmatrix} h^\perp & h \end{bmatrix} \left(X-M\right)$$ Parameter value (in [-1,1]) in the neighborhood of an arc with g = 0.6, assuming constant bulge factor.

Next, note that from the definitions of $$\chi_c$$ and $$\chi_s$$, we seek

$$\sigma = \frac{\tan^{-1} g\chi_s/\chi_c}{\tan^{-1} g} = \frac{\tan^{-1} rg}{\tan^{-1} g}$$

Therefore, $$\sigma$$ depends only on the ratio $$r = \chi_s/\chi_c$$. From the definitions of $$p$$ and $$q$$, we can form $$p = g\left(r^2 - 1\right)\chi_c^2$$ and $$q = \left(1+g^2\right)r\chi_c^2$$. Eliminating $$\chi_c^2$$ from both results in the quadratic equation in $$r$$:

$$gqr^2 - p\left(1+g^2\right) r - gq = 0$$

The desired root is the one of smaller magnitude (not greater than 1), resulting in a value of $$\sigma$$ that is also in the same range. A plot of the parameter $$\sigma$$ in the neighborhood of an arc with $$g=0.6$$ is shown in the figure on the right. Notice that sectors divide the arc into sections of equal arc length.

For points exactly on the arc, this method should exactly recover the parameter value (since it is a direct inversion of the forward evaluation method). However for points off the arc, this method produces results that deviate in a rather unintuitive way since the contours of constant parameter emanate as straight lines from the chord midpoint. One may derive a better parameterization method by treating the problem as assigning a parameter value to each point on the plane, rather than just the restriction to points on the arc. Parameter value (in [-1,1]) in the neighborhood of an arc with g = 0.6, assuming g is computed for an arc passing through each point.

One simple method is to compute the arc with the same endpoints, but passing through each given point, and computing the parameter on this new arc. Phrased differently, we are modifying the lines of constant parameter value to instead trace the points with same parameter value through all arcs with the given endpoints. This corresponds to solving for $$g$$ first, and substituting that into the preceeding calculations. The value of $$g$$ that corresponds to an arc with endpoints $$A$$ and $$B$$, and passing through a point $$X$$ can be computed by first decomposing $$X-M$$ into components parallel and perpendicular to the chord. We may define

$$\alpha = \frac{\left(X-M\right)\cdot\left(M-A\right)}{\left\lVert M-A\right\rVert^2} \qquad \beta = \frac{\left(X-M\right)\times\left(M-A\right)}{\left\lVert M-A\right\rVert^2}$$

Applying the Pythagorean theorem results in a palindromic quadratic equation in $$g$$:

$$\beta g^2 + g\left(1-\alpha^2-\beta^2\right)-\beta = 0$$

In this case if $$g$$ is a root, then $$-1/g$$ is the other root. The root chosen should match the sign of $$\beta$$. A plot of this new parameterization is shown on the right. Parameter value (in [-1,1]) in the neighborhood of an arc with g = 0.6, using a parameterization insensitive to deviations in the radial direction.

Finally, one desirable property for a parameterization would be that it is insensitive to errors in the direction normal to the arc (along the radial direction of the parent circle). This is equivalent to selecting lines of constant parameter to intersect the arc orthogonally. This is a fairly loose requirement, and there are an infinite set of possible parameterizations of the entire plane that respect this constraint. We shall select one that is algorithmically simple. The most straightforward selection is to choose the constant parameter lines that radiate linearly from the center of the circle defining the arc. Of course, we do not want to compute the center explicitly. However, using the previous definition of $$\alpha$$ and $$\beta$$ and again applying the Pythagorean theorem, we see that the angle relative to $$-h^\perp$$ is

$$-\tan^{-1} \frac{2g\alpha}{2g\beta+1-g^2}$$

Therefore, perhaps the simplest and most desirable parameterization is computed by

$$\sigma = -\frac{1}{2} \frac{\tan^{-1} \frac{2g\alpha}{2g\beta+1-g^2}}{\tan^{-1} g}$$

with $$\alpha$$ and $$beta$$ defined above. A plot of this parameterization is shown on the right.