+
+double Geometry::Pack(Arc * a)
+{
+ Point p1 = a->p[0] + (Vector(cos(a->angle[0]), sin(a->angle[0])) * a->radius[0]);
+ Point p2 = a->p[0] + (Vector(cos(a->angle[0] + a->angle[1]), sin(a->angle[0] + a->angle[1])) * a->radius[0]);
+ double endpointLen = Vector::Magnitude(p1, p2) / 2.0;
+
+ // Bump height can be found with h = r ± sqr(r² - a²) where r is the
+ // radius, and a is the 1/2 length of the endpoint's line segment. The
+ // plus/minus term is positive if the arc span is less than 1/2 TAU,
+ // negative if the arc span is greater than 1/2 TAU.
+ double discriminant = sqrt((a->radius[0] * a->radius[0]) - (endpointLen * endpointLen));
+ double bumpLen = a->radius[0] + (discriminant * (fabs(a->angle[1]) < HALF_TAU ? 1.0 : -1.0));
+
+ return (bumpLen / endpointLen) * (a->angle[1] > 0 ? -1.0 : 1.0);
+}