## Circular arcs 1 - representation

I have written a short note on circular arcs, but I feel it would be a good idea to revisit much of that material and explain some of the rationale and derivations. We will begin this series with this article on arc representation.

The goal is to represent an arc: a portion of a circle. In geometric design, an arc may be represented by a circle (center and radius), and starting and ending angles. This is a 5 number representation and is used frequently in 2D geometry engines such as Cairo or Postscript.

Though quite intuitive from a human standpoint, this representation poses a number of problems. First, often one would like to be able to represent a straight line segment, or support continuous variation of an arc through a configuration in which it is a line segment. A circle-based representation is unable to handle this case since the center of the circle would be at infinity with correspondingly infinite radius, and the representation becomes more ill-conditioned the lower the curvature becomes. Second, angles do not provide a unique representation since they are equivalent modulo 360 degrees. And finally, the orientation of the arc (in the sense of a particle travelling along it) must be defined using the ordering of the angles, which makes it clumsy to specify e.g. the smaller or larger part of a circle, given the same angular extents.

Another representation uses three points: two define the endpoints, and the third is a point through which the arc passes, which for non-degenerate cases uniquely defines the arc. This representation does not suffer any of the problems of the circle-based representation, but introduces two new problems. First, 3 points is 6 real numbers: one more than we need. Second, this extra real degree of freedom manifests itself in the form of degeneracies, in whch a straight line segment may be represented an infinite number of ways depending on where the 3rd point lines on the segment. Another ambiguous case is if the 3rd point is collinear but not between the endpoints.

The final representation is one involving the two endpoints and another parameter the determines how much the arc bulges from its chord. There are a few possible reasonable choices for the parameter. First, and most direct, is storing the signed distance of the midpoint of the arc from the chord. This is a poor representation because it is not scale invariant: scaling the underlying space (e.g. doubling the coordinates of the points) requires doubling the distance parameter to represent the same arc. While not a showstopper in any sense, we can do better by representing the "bulginess" using a ratio rather than a distance.

Another choice is to take the ratio of the deviation to the chord length. The parameter takes a value of 0 for a straight line segment, and as it approaches positive and negative infinity, the arc becomes nearly a complete circle. Notably, semicircles have parameter $$\pm \frac{1}{2}$$.

We can improve this ever so slightly by instead use the ratio of the deviation to the half chord length. This representation rescales the parameter space so that semicircles have parameter $$\pm 1$$. The great advantage of this rescaling is in its elegance and symmetries with respect to arc complements. We will denote this bulge parameter by $$g$$, as is done in my note. The half-chord length is $$t$$, and the height of the deviation is $$h$$, so that $$h=gt$$. An arc is then represented by the tuple $$(A, B, g)$$ where $$A$$ and $$B$$ are the endpoints of the arc. Notice that the complementary portion of the circle on which $$(A, B, g)$$ lies is $$(A, B, -1/g)$$. This simple fact bears tremendous computational advantages that we will explore in subsequent articles.

It turns out that Autocad uses this exact representation in the LWPOLYLINE entity. An exploration in Lisp has been written by Stig Madsen, but we will hopefully delve wider and deeper.