User:The Editor's Apprentice/sandbox/4

In differential geometry, a parallel curve, also called an offset curve, is a generalization of the idea of parallel lines to all 2D curves. The concept further generalizes to 3D surfaces where it is called a parallel surface as well as an offset surface. Multiple mathematical definitions exist for parallel curves, not all of which are equivalent.The names "offset curve" and "offset surface" are particularly common in computer-aided design (CAD) and computer graphics contexts.

Parallel curves have multiple practical applications in fields including numerically controlled machining and computer graphics. In numerically controlled machining, they can be used to describe the shape cut out by a round cutting tool of a two-axis machine, such as a CNC wood router. In vector graphics, the approximation of parallel curves is involved in one of the fundamental drawing operations called "stroking". Stroking involves increasing the thicknesses of paths, typically polylines, a connected series of lines, or polybeziers, a connected series of Bézier curves.

Parallel surfaces are important in numerically controlled machining, where they describe the shape of the cut made by a ball-nose-end mill of a three-axis machine. Other shapes of cutting bits can be modeled mathematically by general parallel surfaces.

In most cases, a parallel curve does not maintain the same properties as its generating curve (the curve the parallel curve is based on). For example, even if a generating curve is smooth, its parallel curve may not be. Similarly, even if a curve is rational, such as an ellipse or hyperbola, its parallel curves generally are not so.

Definitions and terminology


Parallel curves can be defined multiple ways, including:
 * 1) the envelope of circles with fixed radii centered on a generating curve,
 * 2) the locus of the points which are at a fixed, normal distance from a generating curve,
 * 3) the locus of consecutive intersections of a system of congruent circles centered on a generating curve, and
 * 4) the boundary of the Minkowski sum of a disk and an generating curve

The four definitions of a parallel curve are not always equivalent. For example, the first assumes smoothness of the generating function while the second does not. Additionally, the Minkowski addition based definition is only valid when the generating curve is a boundary of a planar set and its parallel curve is does not intersect itself.

A parallel surface with a greater volume than that of its generating surface is sometimes called "dilation" and the reverse is sometimes called a "shelling".

The variable $$d$$ is commonly used for the distance between a generating curve and a parallel curve.

General geometric properties

 * Tangent vectors of a generating curve are parallel to the corresponding normal vectors of its parallel curve.
 * Additionally, the same is true for the normal vectors of a generating and parallel curve.
 * Parallel curves have cusps when the curvatures of the generating curve and the parallel curve are equal. The cusps are also points where the curve touches the evolute.
 * The radii$R_d(t)=R(t) + d,$ where $$R(t)$$ and $R_d(t)$  are respectively the radii of curvature of the generating and parallel curves.


 * $k_d(t)=\frac{k(t)}{1+dk(t)},$ where $k(t)$  and $$k_d(t)$$ are respectively the curvatures of the generating and the parallel curves.

Parametric curves
A regular parametric representation, $ \vec x= (x(t),y(t))$, of a curve using locus of points definition of leads to the following parametric representation of the parallel curve a distance $ d$ away:


 * $$\vec x_d(t)=\vec x(t)+d\vec n(t)$$
 * where $\vec n(t)$ representing the unit normal vector of $ \vec x$  at $ t$.

Translated into Cartesian coordinates:


 * $$ x_d(t)= x(t)+\frac{d\; y'(t)}{\sqrt {x'(t)^2+y'(t)^2}}$$
 * $$ y_d(t)= y(t)-\frac{d\; x'(t)}{\sqrt {x'(t)^2+y'(t)^2}}.$$

In the cases when $$d$$ is negative, the parallel curve is on the opposite side of the generating curve than when $$d$$ is positive.

If the generating curve is polynomial, meaning that both $$x(t)$$ and $$y(t)$$ are polynomials, then the parallel curves are usually not polynomial. In the context of CAD, this is a drawback because CAD systems use polynomials or rational curves. In order to get at least rational curves, the square root of the representation of the parallel curve has to be solvable. Such curves are called "pythagorean hodograph curves" and were covered in detail by R.T. Farouki.

Implicit curves
Generally, the analytic representation of a parallel curve based on an implicit curve is not possible. Only for the simple cases of lines and circles the parallel curves can be described easily. For example, the line $$ f(x,y)=x+y-1=0$$ has the distance function $h(x,y)=\frac{x+y-1}{\sqrt{2}}=d$ inHesse normal form. Similarly, the circle $f(x,y)=x^2+y^2-1=0$ has the distance function $h(x,y)=\sqrt{x^2+y^2}-1=d$.

In general, presuming certain conditions, one can prove the existence of an oriented distance function $$h(x,y)$$, but in practice one has to treat it numerically.

Properties of the distance function

 * The parallel curve for distance d is the level set $$h(x,y)=d$$ of the corresponding oriented distance function $$h$$,
 * $$| \operatorname{grad} h (\vec x)|=1$$,
 * $$h(\vec x+d\operatorname{grad} h (\vec x)) = h(\vec x)+d$$,
 * $$\operatorname{grad}h(\vec x+d\operatorname{grad}h (\vec x))= \operatorname{grad}h (\vec x)$$.

Of note, the curves $$f(x,y)=x^4+y^4-1=d$$ are not parallel curves of $$f(x,y)=x^4+y^4-1=0$$ because $$| \operatorname{grad} f (x,y)|\neq 1$$ in the area of interest.

Specific cases

 * The involutes of an generating curve are a set of parallel curves. For example: the involutes of a circle are parallel spirals.

The following is true about the parallel curves of certain generating functions:


 * A parabola has as (two-sided) offsets rational curves of degree 6.
 * A hyperbola or an ellipse has as (two-sided) offsets an algebraic curve of degree 8.
 * A Bézier curve of degree $n$ has as (two-sided) offsets algebraic curves of degree $4n − 2$. In particular, a cubic Bézier curve has as (two-sided) offsets algebraic curves of degree 10.
 * More information at http://web.archive.org/web/20160303214952/http://www3.uah.es/fsegundo/Otros/Offset/16-SanSegundoSendraSendra-1532.pdf

Corners
When determining the cutting path of part with a sharp corner for machining, a parallel curve needs to defined which accommodates the discontinuous normal of the generating curve at the corner. Even though the generating curve is not smooth at the sharp corner, its parallel curve may be smooth with a continuous normal, or it may have may have cusps when the distance from the curve matches the radius of curvature at the sharp corner.

Normal fans
As described in the section on parametric curves, the parametric representation of a parallel curve, $$\vec x_d(t)$$, to a generating curve, $$\vec x(t)$$, with distance $$d$$ is:


 * $$\vec x_d(t) = \vec x(t) + d\vec n(t)$$ with the unit normal $$\vec n(t)$$.

At a sharp corner, for example where $$t = t_c$$, the normal to $$\vec x(t_c)$$ is undefined. This is because $$\vec n(t)$$ has a jump discontinuity at $$t_c$$. Specifically, the one-sided limit of the normal from the left, $$\vec n(t_c^-)$$, is unequal to the limit from the right, $$\vec n(t_c^+)$$. Mathematically,
 * $$\vec n(t_c^-) = \lim_{t \to t_c^-}\vec n(t) \ne \lim_{t \to t_c^+}\vec n(t) = \vec n(t_c^+)$$.

A normal fan $$\vec n_f(\alpha)$$ can be used in the interpolate between $$\vec n(t_c^-)$$ and $$\vec n(t_c^+)$$ by being used in place of $$\vec n(t_c)$$ at the sharp corner in the definition of $$\vec x_d(t) .$$ Such a normal fan is defined as


 * $$\vec n_f(\alpha) = \frac{(1 - \alpha)\vec n(t_c^-) + \alpha\vec n(t_c^+)}{\lVert (1 - \alpha)\vec n(t_c^-) + \alpha\vec n(t_c^+) \rVert},\quad$$where $$0 < \alpha < 1$$.

The resulting definition of the parallel curve $$\vec x_d(t)$$ incorporating the normal fan is


 * $$\vec x_d(t) = \begin{cases}

\vec x(t) + d\vec n(t), & \text{if }t < t_c\text{ or }t > t_c \\ \vec x(t_c) + d\vec n_f(\alpha), & \text{if }t = t_c\text{ where }0 < \alpha < 1 \end{cases}.$$

Algorithms
An efficient algorithm for offsetting is the level approach described by Kimel and Bruckstein (1993).

There are numerous approximation algorithms for this problem, cf. Elber et. al. 1997.

Parallel surfaces
parallel surfaces are important in numerically controlled machining, where they describe the shape of the cut made by a ball nose end mill of a three-axis mill. If there is a regular parametric representation $$\vec x(u,v) = (x(u,v),y(u,v),z(u,v))$$ of the generating surface available, the second definition of a parallel curve (see above) generalizes to the following parametric representation of the parallel surface with distance $$|d|$$:


 * $$\vec x_d(u,v)=\vec x(u,v)+d\vec n(u,v)$$ with the unit normal $$\vec n_d(u,v) = {{{\partial \vec x \over \partial u} \times {\partial \vec x \over \partial v}} \over {|{{\partial \vec x \over \partial u} \times {\partial \vec x \over \partial v}}|}}$$.

Distance parameter $$d$$ may be negative, too. In this case one gets a parallel surface on the opposite side of the surface (see similar diagram on the parallel curves of a circle). One easily checks: a parallel surface of a plane is a parallel plane in the common sense and the parallel surface of a sphere is a concentric sphere.

===Geometric properties ===
 * $${\partial \vec x_d \over \partial u} \parallel {\partial \vec x \over \partial u}, \quad {\partial \vec x_d \over \partial v} \parallel  {\partial \vec x \over \partial v}, \quad$$ that means: the tangent vectors for fixed parameters are parallel.
 * $$\vec n_d(u,v) = \pm\vec n(u,v), \quad$$ that means: the normal vectors for fixed parameters match direction.
 * $$S_d = (1 + d S)^{-1} S, \quad$$ where $$S_d$$ and $$S$$ are the shape operators for $$\vec x_d$$ and $$\vec x$$, respectively.
 * The principal curvatures are the eigenvalues of the shape operator, the principal curvature directions are its eigenvectors, the Gaussian curvature is its determinant, and the mean curvature is half its trace.


 * $$S_d^{-1} = S^{-1} + d I, \quad$$ where $$S_d^{-1}$$ and $$S^{-1}$$ are the inverses of the shape operators for $$\vec x_d$$ and $$\vec x$$, respectively.
 * The principal radii of curvature are the eigenvalues of the inverse of the shape operator, the principal curvature directions are its eigenvectors, the reciprocal of the Gaussian curvature is its determinant, and the mean radius of curvature is half its trace.

Note the similarity to the geometric properties of parallel curves.

Generalizations
Parallel curves directly generalize to higher dimensions, including parallel surfaces in three dimensions, and, with a little more work, pipe surfaces. Terminology varies widely for higher dimensional generalizations since there are multiple kinds. Names include parallel fibers, ribbons, and tubes. For curves embedded in 3D surfaces the offset may be taken along a geodesic. Another way to generalize parallel curves is, even in 2D, to consider a variable distance, for example, a situation where the distance is parameterized by another function. Other generalizations involve stroking, i.e. forming the envelope, with an ellipse instead of circle, as it is possible for example in METAFONT. In 2010, a similar feature was added in Adobe Illustrator in version CS5, where control points for the variable width are visually specified.

In contexts where it's important to distinguish between constant and variable distance offsetting the acronyms "CDO" for "constant distance offsetting" and "VDO" for "variable distance offsetting" are sometimes used.

General parallel curves
A regular parametric representation of a curve, $$\vec x(t) = (x(t),y(t))$$, together with a second function that can be parameterized by its unit normal, $$\vec d(\vec n)$$, where the normal of $$\vec d(\vec n) = \vec n$$. The parametric representation of the general offset curve of $$\vec x(t)$$ offset by $$\vec d(\vec n)$$ is:


 * $$\vec x_d(t)=\vec x(t)+ \vec d(\vec n(t)), \quad$$ where $$\vec n(t)$$ is the unit normal of $$\vec x(t)$$.

Note that the trivial offset, $$\vec d(\vec n) = d\vec n$$, gives you ordinary parallel (aka, offset) curves.

(this parameterization by normal exists for curves whose curvature is strictly positive or negative, and thus convex, smooth, and not straight)

Geometric properties

 * The curvature of the a parallel curve, $$k_d(t)$$, the curvature of $$\vec x(t)$$,  $$k(t)$$, and $$k_n(t)$$ the curvature of $$\vec d(\vec n(t))$$ are related such that $k_d(t)=\dfrac{k(t)}{1+\dfrac{k(t)}{k_n(t)}}.$
 * $$R_d(t)=R(t) + R_n(t),\quad$$ with $$R_d(t)$$ the radius of curvature of the general offset curve, $$R(t)$$ the radius of curvature of $$\vec x(t)$$, and $$R_n(t)$$ the radius of curvature of $$\vec d(\vec n(t))$$ for parameter $$t$$.

General parallel surfaces
General parallel surfaces describe the shape of cuts made by a variety of cutting bits used by three-axis end mills in numerically controlled machining. Assume you have a regular parametric representation of a surface, $$\vec x(u,v) = (x(u,v),y(u,v),z(u,v))$$, and you have a second surface that can be parameterized by its unit normal, $$\vec d(\vec n)$$, where the normal of $$\vec d(\vec n) = \vec n$$ (this parameterization by normal exists for surfaces whose Gaussian curvature is strictly positive, and thus convex, smooth, and not flat). The parametric representation of the general parallel surface of $$\vec x(t)$$ offset by $$\vec d(\vec n)$$ is:


 * $$\vec x_d(u,v)=\vec x(u,v)+ \vec d(\vec n(u,v)), \quad$$ where $$\vec n(u,v)$$ is the unit normal of $$\vec x(u,v)$$.

Note that the trivial offset, $$\vec d(\vec n) = d\vec n$$, gives you ordinary parallel (aka, offset) surfaces.

Geometric properties

 * As for parallel lines, the tangent plane of a surface is parallel to the tangent plane of its general offsets.
 * As for parallel lines, a normal to a surface is also normal to its general offsets.
 * $$S_d = (1 + SS_n^{-1})^{-1} S, \quad$$ where $$S_d, S,$$ and $$S_n$$ are the shape operators for $$\vec x_d, \vec x,$$ and $$\vec d(\vec n)$$, respectively.
 * The principal curvatures are the eigenvalues of the shape operator, the principal curvature directions are its eigenvectors, the Gaussian curvature is its determinant, and the mean curvature is half its trace.


 * $$S_d^{-1} = S^{-1} + S_n^{-1}, \quad$$ where $$S_d^{-1}, S^{-1}$$ and $$S_n^{-1}$$ are the inverses of the shape operators for $$\vec x_d, \vec x,$$ and $$\vec d(\vec n)$$, respectively.
 * The principal radii of curvature are the eigenvalues of the inverse of the shape operator, the principal curvature directions are its eigenvectors, the reciprocal of the Gaussian curvature is its determinant, and the mean radius of curvature is half its trace.

Note the similarity to the geometric properties of general offset curves.

Derivations of properties
The geometric properties listed above for general offset curves and surfaces can be derived for offsets of arbitrary dimension. Assume you have a regular parametric representation of an n-dimensional surface, $$\vec x(\vec u)$$, where the dimension of $$\vec u$$ is n-1. Also assume you have a second n-dimensional surface that can be parameterized by its unit normal, $$\vec d(\vec n)$$, where the normal of $$\vec d(\vec n) = \vec n$$ (this parameterization by normal exists for surfaces whose Gaussian curvature is strictly positive, and thus convex, smooth, and not flat). The parametric representation of the general parallel surface of $$\vec x(\vec u)$$ offset by $$\vec d(\vec n)$$ is:


 * $$\vec x_d(\vec u) = \vec x(\vec u)+ \vec d(\vec n(\vec u)), \quad$$ where $$\vec n(\vec u)$$ is the unit normal of $$\vec x(\vec u)$$. (The trivial offset, $$\vec d(\vec n) = d\vec n$$, gives you ordinary parallel surfaces.)

First, notice that the normal of $$\vec x(\vec u) =$$ the normal of $$\vec d(\vec n(\vec u)) = \vec n(\vec u),$$ by definition. Now, we'll apply the differential w.r.t. $$\vec u$$ to $$\vec x_d$$, which gives us its tangent vectors spanning its tangent plane.


 * $$\partial\vec x_d(\vec u) = \partial\vec x(\vec u)+ \partial\vec d(\vec n(\vec u))$$

Notice, the tangent vectors for $$\vec x_d$$ are the sum of tangent vectors for $$\vec x(\vec u)$$ and its offset $$\vec d(\vec n)$$, which share the same unit normal. Thus, the general parallel surface shares the same tangent plane and normal with $$\vec x(\vec u)$$ and $$\vec d(\vec n(\vec u))$$. That aligns with the nature of envelopes.

We now consider the Weingarten equations for the shape operator, which can be written as $$\partial\vec n = -\partial\vec xS$$. If $$S$$ is invertible, $$\partial\vec x = -\partial\vec nS^{-1}$$. Recall that the principal curvatures of a surface are the eigenvalues of the shape operator, the principal curvature directions are its eigenvectors, the Gauss curvature is its determinant, and the mean curvature is half its trace. The inverse of the shape operator holds these same values for the radii of curvature.

Substituting into the equation for the differential of $$\vec x_d$$, we get:


 * $$\partial\vec x_d = \partial\vec x - \partial\vec n S_n^{-1},\quad$$ where $$S_n$$ is the shape operator for $$\vec d(\vec n(\vec u))$$.

Next, we use the Weingarten equations again to replace $$\partial\vec n$$:


 * $$\partial\vec x_d = \partial\vec x + \partial\vec x S S_n^{-1},\quad$$ where $$S$$ is the shape operator for $$\vec x(\vec u)$$.

Then, we solve for $$\partial\vec x$$ and multiple both sides by $$-S$$ to get back to the Weingarten equations, this time for $$\partial\vec x_d$$:


 * $$\partial\vec x_d (I + S S_n^{-1})^{-1} = \partial\vec x,$$
 * $$-\partial\vec x_d (I + S S_n^{-1})^{-1}S = -\partial\vec xS = \partial\vec n.$$

Thus, $$S_d = (I + S S_n^{-1})^{-1}S$$, and inverting both sides gives us, $$S_d^{-1} = S^{-1} + S_n^{-1}$$.