Next: Connection of Path Segments
Up: Stroked Characters
Previous: Approach
Contents
Index
Computation of Parallel Paths
For straight lines, the notion of a parallel path in distance
immediately
becomes evident, but what about Bezier curves? Let us define the parallel of a
curve as the infinite set of points, that results from tracing along the
curve and for each point of the curve computing the point which in direction
orthogonally to the curve's tangent at the respective location is just the
distance
apart.
The parallel curve resulting from the principle above actually no longer
is a third order Bezier curve. But if a few additional constraints hold, it
can be approximated quite well by such a third order Bezier curve:
- The curvature should not exceed an angular range of 90 degrees. This
condition automatically is fulfilled for Type 1 fonts which adhere to the
Adobe recommendations.
- The strokewidth the curve should be drawn width is small compared to
the extension and the curvature of the curve. This principle usually is
fulfilled by nature because tracing a character outline path with a very
thick pen won't lead to a good representation of the character.
In the following, we will describe how to compute a parallel Bezier curve
defined by four points
,
,
and
,
given an original Bezier curve defined by four points
,
,
and
and a strokewidth . The computation of parallel
straight lines results as the special case of only respecting the points
and
from these considerations.
Figure
represents the basis of our discussion.
Figure:
Construction of parallel Bezier path
segments. The original curve is shown in dashed style and the light gray
area indicates the thick Bezier curve segment that later will result from
filling between left and right parallel path. Furthermore, important
intermediate points are shown. A detailed discussion is given in the text.
|
It shows the original mathematically thin Bezier segment defined by the points
,
,
and
in dashed style. The
counterpart of
in the parallel path follows from simple geometric
considerations, as illustrated for the point
. It lies half the
strokewidth away from
and the direction is determined by the
location of point
. For the two coordinates of
we find
 |
(1) |
and
 |
(2) |
Corresponding equations can be derived for the point
, so that, up to now, we
are able to compute parallel straight line segments. It remains to compute two
control points,
and
, in a way that the resulting Bezier
curve appears as parallel to the original curve in the sense defined above.
In order to make the path at point
actually parallel to the orginal
path at
, we require
to be parallel to
. From this we can derive an equation that expresses the fact that
lies somewhere on the straight line that runs through point
and has the direction
, i.e.,
 |
(3) |
and correspondingly
 |
(4) |
for point
. Here,
and
are two positive quantities, whose
exact values are still to be determined.
In order to compute
and
, we consider a third point on the
curve. Using a well-known algorithm that iteratively approximates a Bezier
curve via straight line segments, we can easily determine the coordinates of
the point that--in the parameter equation
of a Bezier
curve--corresponds to the parameter
. It can be considered as a middle point of the curve segment. In Figure
, this
point is named
. It can be computed by computing some intermediate
points:
 |
(5) |
 |
(6) |
 |
(7) |
 |
(8) |
 |
(9) |
and finally
 |
(10) |
Using the same geometrical considerations as in Eqs.
and
, we can now compute a unit vector,
, perpendicular to
the curve at
and obtain
 |
(11) |
 |
(12) |
can now be computed as
 |
(13) |
where
, i.e., the vector orthogonal to the
curve at
with a length of half the strokewidth . As before, we
have to require that the slope of the curve
equals the one at
, i.e., with respect to Figure
we find
and hence finally
 |
(14) |
We have thus expressed the slope condition at
in terms of the
characteristic points of a Bezier curve and a factor,
, still to be
determined (cf. Eqs.
and
). On the way to
Eq.
, we made use of the well-known geometrical relations
Eqs.
-
.
Based on the same considerations that led to Eq.
, we can write
the corresponding equation for the point
:
 |
(15) |
Exploiting Eq.
and solving for
, we can reorganize
Eq.
:
 |
(16) |
From this equation, we are able eliminate
by substituting the
transformed slope condition for point
(Eq.
). We
obtain
Here, for the sake of brevity, we introduced a location vector,
,
and a direction vector,
, which together with the parameter
define the point
.
Considering Eqs.
and
, we finally found two
independent relations for
, that linearly depend on two quantities,
and
. Therefore, by substituting the right hand sides
of (
) and (
), we obtain the following
system of linear equations:
 |
(18) |
Formally, all vectors appearing in this equation are column vectors. The
solution of the system can be written as
![\begin{displaymath}
\left(
\begin{array}{cc}
\mu_C \\
\nu/2
\end{array} ...
...d{array} \right]^{-1}
\left( \vec{l}_C - \vec{D}' \right)\, .
\end{displaymath}](img224.png) |
(19) |
Once
has been computed, it is easy to compute
, by making
use of Eq.
.
A few remarks about the approach described above are appropriate.
- It is also possible to first compute the point
and then use
Eq.
to compute
.
- The numerical stability at the respective end of the curve determines
the preference of which point to compute first. A criterion for the
numerical stability is the absolute value of determinant of the
matrix in Eq.
.
- This determinant may become zero in which case the curve transforms into
a straight line. These cases must be treated extraordinarily.
- There are a number of further exceptional cases, e.g., if point
equals
. Then the slope at this end of the curve is not enforced by
point
.
- A good solution, that is, a parallel curve, will only result, if
the set of assumptions discussed previously holds. If the resulting curve
does not appear parallel to the original curve, the parallel curve
cannot be approximated by a third order Bezier spline.
Next: Connection of Path Segments
Up: Stroked Characters
Previous: Approach
Contents
Index
2004-10-04