Letting
B0 = A3
and
B3 = C0
ensures
G0 continuity (location). Choosing
B1
to be collinear with
A2A3
will ensure
G1 continuity (direction) at
B0
, and similarly choosing
B2
to be collinear with
C0C1
ensures
G1 continuity at
B3
.
Now there remain two degrees of freedom for the placement of
B1
and
B2
. I guess that these can be used to achieve
G2 continuity (curvature) as well.
Now a little bit of math. In the following document
http://www.tsplines.com/resources/class_notes/Bezier_curves.pdf[
^], you find an interesting formula on page 22, telling you that the curvature equals
h/a^2
(dropping the constant
n-1/n
), where
a
is the length of the first leg of the control polygon, and
h
is the perpendicular distance from the second control point to the first leg of the control polygon.
We state that
B1 = B0 + a U
and
B2 = B3 + a' V
, where
U
and
V
are the unit vectors in the directions of
B0B1
and
B3B2
respectively.
h
and
h'
are obtained by projecting
B1B2
onto
U
and
V
:
h = B1B2 /\ U = (B0B3 + a' V) /\ U = p + q a'
,
h' = B1B2 /\ V = (B0B3 + a U) /\ V = p' - q a
. (
/\
is the vector product operator, a 2x2 determinant in 2D).
This can be put together with the known curvatures at endpoints computed from the other two arcs:
h = K a^2
and
h' = K' a'^2
.
Elimination of three unknowns gives us a quartic equation in
a
, hence 0 to 4 solutions.
p + q a' = K a^2<br />
p' - q a = K' a'^2<br />
<br />
=><br />
<br />
(p' - q a) q^2 = K' (K a^2 - p)^2
:-(