Two-point G2 Hermite interpolation with spirals by inversion of hyperbola

Two-point G2 Hermite interpolation with spirals by inversion of hyperbola

Computer Aided Geometric Design 27 (2010) 474–481 Contents lists available at ScienceDirect Computer Aided Geometric Design www.elsevier.com/locate/...

264KB Sizes 0 Downloads 73 Views

Computer Aided Geometric Design 27 (2010) 474–481

Contents lists available at ScienceDirect

Computer Aided Geometric Design www.elsevier.com/locate/cagd

Two-point G2 Hermite interpolation with spirals by inversion of hyperbola A.I. Kurnosenko Private Research, Russian Federation

a r t i c l e

i n f o

a b s t r a c t

Article history: Received 31 August 2009 Received in revised form 23 February 2010 Accepted 8 March 2010 Available online 11 March 2010

Planar, 4th degree rational spirals, matching given G2 Hermite data, are constructed by inversion of hyperbola. The proposed method handles any data for convex spiral arcs, and a great deal of non-convex data. Non-convex data are either with an inflection, or with big angular winding. © 2010 Elsevier B.V. All rights reserved.

Keywords: Spiral Lens Rational curve Inversion Möbius map

1. Introduction This paper continues the previous article (Kurnosenko, 2010), where inversion of canonical spirals was proposed as a method of two point G2 Hermite interpolation. Among the variety of continuous (convex) conics one particular case, parabolic arc, had provided a simple solution. Similarly, among discontinuous conics there is one particular case, hyperbola with parallel tangents at the endpoints, worth special attention. The solution turned out to be even more simple and the most universal from the standpoint of the range of handled G2 data. In this note the same notation is used as in Kurnosenko (2010). As for the theoretical background, we add some facts from the theory of long spirals. This allows us to work with curves like shown in Fig. 1(c, d). By doing so, we simply exploit all capabilities of the method. Possibly, introducing long spirals will give a handle to expand the field of uses of the interpolation with spirals. Compared to other methods, the range of matchable boundary conditions is wider even from the viewpoint of G1 data. The quantitative measure of the criticality of given data in terms of Kurnosenko (2010) refers to inversive invariants:

|σ |  π ,

Q < 0.

(1)

The first inequality allows us to interpolate any data for convex spiral arcs, and a great deal of non-convex data. The second one means that there are no restrictions for curvatures. The non-convexity may be of two kinds: an inflection, or rather big winding (long spiral). The situation |σ | > π means too wide freedom in constructing a curve, which is not typical for interpolation problems.

E-mail address: [email protected]. 0167-8396/$ – see front matter doi:10.1016/j.cagd.2010.03.001

© 2010

Elsevier B.V. All rights reserved.

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

475

Fig. 1. Möbius images of discontinuous hyperbolic arc.

Fig. 2. Defining cumulative boundary angles for a long spiral by continuity.

2. Long spirals We call a spiral arc long if it does not fit in the definition of a short spiral (Definition 1 in Kurnosenko, 2010). Curve ARB in Fig. 1(c) is long, because it intersects, at the point R, the right complement of the chord AB to an infinite straight line: x R > 1, y R = 0. Similarly, intersection of the left complement of the chord occurs at the point L of the arc ALB (x L < −1, y L = 0). Twisting spiral may meet complements of the chord several times. In this note we deal with short spirals, and with those long ones, which meet the complement of the chord only once. 



In Fig. 2 the point P moves along the spiral A B. For every instance of the subarc A P , resting on the chord of the length | A P | = 2c, the local coordinate system is constructed such that A = (−c , 0), P = (c , 0). Directions of tangents, α at the point −−→ A, and β at the point P , are measured with respect to the vector A P , i.e. the current x-axis. 

The arcs A P remain short spirals until the moving point P reaches the position P 3 , and the angle β attains the value 180◦ . By continuity, the value β = 220◦ , not −140◦ , is assigned to the angle β of the whole arc AB, when the moving point reaches the position B. Thus defined cumulative boundary angles remember and keep the history of twisting of the spiral. To assign proper cumulative values to α , β the process, shown in Fig. 2, can be applied to the draft of the desired path. Or the rule, described in Section 4 (Step 2), can be used. The process with the moving point is repeated in Fig. 3, where the lens is shown for the current position of the point P . Each row starts with a rather narrow lens, similar to lens in the usual sense of the word. As the width |σ | increases, this similarity smoothly disappears. A lens may become a whole circle and wider (Fig. 3(a)). It can turn into a half-plane, as in Fig. 3(b). In Fig. 3(c) the lens, when it attains the width π , becomes the exterior of the circle. “Lens” of the width |σ | > 2π occupies the whole plane. Fig. 3 illustrates also the fact that σ is a monotone function of the arc length, increasing or decreasing, as curvature does (Kurnosenko, 2009, Theorem 1). The corollary to this monotonicity is the expansion of the modified Vogt’s theorem (St. 3 in Kurnosenko, 2010) to a spiral of any length:

sign(α + β) = sign(b − a),

(2)

where a, b are normalized curvatures at the endpoints (Definition 2 in Kurnosenko, 2010). In Fig. 2 curvature increases (a < b), and σ = α + β > 0. The statement that the cumulative value of σ is invariant under Möbius transformations results from the considerations of continuity. We can now see that inequality |σ |  π in (1) is not in fact a severe restriction: it allows us to choose a rather long segment of any spiral. 3. Hyperbola with parallel tangents We replace the 2-parametric (p, q) family of parabolas of Kurnosenko (2010) by the 2-parametric family of hyperbolas, L and ω being the parameters of the family, t or u = 2t − 1 parametrizes the curve (u-parametrization is often convenient in calculations due to its symmetry):

476

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

Fig. 3. Transformation of the lens in the course of lengthening of the arc.

x(t ) =

(1 − t )2 + 2Lt (1 − t ) cos ω + t 2 , 2t − 1

y (t ) =

2Lt (1 − t ) sin ω 2t − 1

,

0  t  1,

(3a)

or

x(u ) =

L (1 − u 2 ) cos ω + 1 + u 2 2u

y (u ) =

,

L (1 − u 2 ) sin ω 2u

−1  u  1,

,

(3b)

where

L > 0 and

0 < |ω | 

π 2

(3c)

.

This curve is a part of the hyperbola, centered at the coordinate origin, and traced from the point A = (−1, 0) at t = 0, through infinity at t = 12 , to the point B = (1, 0) at t = 1 (Fig. 1(a)). Calculating derivatives and curvature yields

x (u ) = x (u ) =

(1 − L cos ω)u 2 − (1 + L cos ω) 2u 2 1 + L cos ω u3

where f (u ) = Boundary angles



,

y  (u ) =

y  (u ) =

,

L sin ω u3

,

− L sin ω(u 2 + 1)

k (u ) =

2u 2 8Lu 3 sin ω f 3 (u )

,

τ (u ) = arg(x + i y  ),

,

(1 − 2L cos ω + L 2 )u 4 + 2( L 2 − 1)u 2 + (1 + 2L cos ω + L 2 ).

α = τ (−1), β = τ (1), and curvatures a = k(−1), b = k(1) are

cos α = cos β = − cos ω, sin α = sin β = − sin ω,

a = −b,

b=

sin ω L2

(4)

.

Proposition 1. Hyperbola (3) has no curvature extrema in the interval u ∈ (−1, 1). Proof. Consider derivative

k (u ) = 24Lu 2 sin ω

1 + 2L cos ω + L 2 − (1 − 2L cos ω + L 2 )u 4 f 5 (u )

,

and solve the equation k (u ) = 0 for the positions of vertices. Derivative k (u ) does not change sign near u = 0. Two other real roots are



u vx = ±

4

1 + 2L cos ω + L 2 1 − 2L cos ω + L 2

.

The hyperbola is free from vertices if |u vx |  1, i.e. L cos ω  0, which is guaranteed by conditions (3c) in the curve’s definition. 2

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

477

To convert discontinuous hyperbola into a regular spiral we use the same Möbius map as Kurnosenko (2010):

W ( z; z0 ) =

z + z0 1 + z0 z

,

z0 = x0 + i y 0 = ±1.

(5)

The image of the infinite point under map (5) is a regular point on the curve, and the image of the asymptote is the circle of curvature at this point. To choose transformation one can select the desired position w ∞ = ±1 of the former infinite point, and solve the equa1 tion W (∞; z0 ) = w ∞ for z0 . The solution is z0 = w − ∞ . Three curves-images in Fig. 1(b) are obtained for w ∞ = −i; 0; i/2. Points w ∞ are marked by dots. These spirals are short. Constructing a long spiral could be forced by moving the infinite point (or any other internal point of the hyperbola) to the complements of the chord AB, i.e. choosing w ∞ real, and such that | w ∞ | > 1. Examples with w ∞ = −2 and w ∞ = 3 are shown in Fig. 1(c). In Fig. 1(d) w ∞ = −1 − 2i and w ∞ = −1 + i. The Möbius invariant Q for two boundary circles of curvature, defined in Kurnosenko (2010) as

Q (α , β, a, b) = (a + sin α )(b − sin β) + sin2

α+β

becomes, after substitutions (4), the function of L and

Q ( L , ω) = −

sin2 ω(1 + 2L 2 ) L4

2

(6)

,

ω: (7)

.

As for σ ≡ α + β (mod 2π ), we can calculate cos(α + β) = cos(2ω) and sin(α + β) = sin(2ω). Taking into account the cumulative meaning of σ , we have to select a proper value among the possibilities 2ω , 2ω ± 2π , . . . . But, unfortunately, we cannot apply the process with the moving point (Figs. 2, 3) because of the discontinuity of the hyperbola in question. Proposition 2. The invariant σ for a family of spirals W ( z(u ), z0 ), obtained as images of hyperbola (3) under Möbius map, is

σ ( L , ω ) = 2ω .

(8)

Proof. Denote z(u ) = x(u ) + i y (u ), and consider the curve z−1 (u ) ≡ W ( z(u ); ∞). This is a segment of a lemniscate-like curve (AOB in Fig. 1(b)). The arc −1  u  1 has no vertices, and is a short spiral by construction: the original hyperbola has no points within its chord; respectively, no point in the complement of the chord may appear in the inverse curve. The cumulative boundary angles α1 , β1 of this spiral are in the range [−π , π ], and can be easily defined without writing explicit equation of the curve: the map W ( z(u ); ∞) is the inversion of hyperbola (3) with respect to the unit circle, followed by the reflection across the x-axis. So, the angles α , β = ω±π (4) are transformed to α1 = β1 = ω , and σ1 = α1 + β1 = 2ω . Due to the group property of Möbius map (5), any curve, obtained by transformation of this lemniscate, can be considered as the image of the hyperbola, and vice versa. The cumulative value of σ being invariant, assignment (8) is justified. 2 The values of boundary angles (4) can be adjusted to fit condition

α = ω ± π,

α + β = 2ω as follows:

β = 2ω − α = ω ∓ π .

(9)

4. Solution for two-point G2 Hermite interpolation problem We assume that G2 Hermite data to be matched have been brought into standard normalized form, and solve the problem for given data

{−1, 0, α , a } and {1, 0, β , b }.

(10)

The inversion invariants for the given data are

Q = (a + sin α )(b − sin β ) + sin2

α + β 2

,

σ = α + β .

To match this data, we find hyperbola (3) whose boundary angles

(11) (7)

α , β and curvatures a, b are such that Q ( L , ω) = Q , and

(8)

σ ( L , ω) = σ . The solution, satisfying conditions (3c),    σ | sin ω|  | sin ω| + sin2 ω − Q , ω= , L= 2 −Q exists, if |σ |  π and Q < 0. This explains limits (1) of the applicability of the method.

(12)

478

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

Fig. 4. Long curves, constructed by (a) inversions of hyperbola; (b) inversions of parabola (dotted lines) and hyperbola (solid line).

Having found L , ω , we can calculate α , a (or β, b) from (4). The sought for spiral will be found as the transformation of thus found hyperbola (3) by map (5) with

z0 =

r0 eiλ0 − 1 r0 eiλ0 + 1

,

⎧ ⎨ λ0 = α − α = β − β , a + sin α b − sin β where = ⎩ r0 = a + sin α b − sin β

(Kurnosenko, 2010, Proposition 1). The above equations can be simplified by eliminating sions for r0 yields:

α , β , a, b. Combining two expres-

a + sin α b − sin β b − sin β =− r02 = · a + sin α b − sin β a + sin α due to a = −b and sin α = sin β (4). And, from (9)

2λ0 = (α − α ) + (β − β ) = α − β + (β − α ) = α − β ± 2π . The deformation parameters λ0 , r0 , expressed via given G2 data only, look like

λ0 =

α − β 2



± π,

r0 =



b − sin β a + sin α

(13)

.

The choice ±π does not affect the value of z0 , and may serve to bring λ0 to the standard range of the function arg(·). To express explicitly the sought for 4th degree spiral we introduce abbreviations A , B for the numerators, and C for the denominator of (3a); t 1 stands for 1 − t:

A = t 12 + 2Ltt 1 cos ω + t 2 ,





W z(t ); z0 = where T 1 (t ) T 2 (t ) T 3 (t )

B = 2Ltt 1 sin ω,

C = 2t − 1 ≡ t − t 1 ,

T 1 (t )r02 − T 2 (t ) + 2ir0 [2BC cos λ0 − T 3 (t ) sin λ0 ] , T 1 (t )r02 + T 2 (t ) − 2r0 [2BC sin λ0 + T 3 (t ) cos λ0 ]

= ( A + C )2 + B 2 ≡ 4t 2 L 2 t 12 + 2Ltt 1 cos + t 2 ,

= ( A − C )2 + B 2 ≡ 4t 12 L 2 t 2 + 2Ltt 1 cos + t 12 ,



= A 2 − C 2 + B 2 ≡ 4tt 1 L t 2 + t 12 cos + 2 L 2 + 1 tt 1 .

(14)

ω ω

ω

Below the construction is described step-by-step. Step 1. Calculate Q (11). Check if a general non-biarc spiral exists, i.e. Q < 0. Step 2. Define m = sign(b − a ). Bring boundary angles α , β to either the range (−π , π ] if m = +1 (curvature increases), or to the range [−π , π ) for m = −1 (decreasing curvature). Check condition m = sign(α + β ) (2). If it is satisfied, go to Step 3. If it is not satisfied, no short spiral exists. Try to construct a long one. To do it, correct one of the angles by adding

±2π . Namely, replace α by α + 2π m if the arc is expected to intersect the left complement of the chord; replace β by

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

479

Fig. 5. Cornu spiral (shown by dotted line) and its piecewise interpolation. The whole arc is split into 3 (C 0 C 1 C 2 C 3 ) or 6 (C 0 C 1 . . . C 6 ) segments. Curvature plots are shown at the right side. Abscissa si is the arc length of Cornu spiral at the point C i .

β + 2π m if the intersection of the right complement is expected. E.g., in Fig. 4(a) in Fig. 4(b). Below the correction is underlined:

Fig. 4(a):

⎧ a = −1.7 ⎪ ⎪ ⎪ ⎨ b = −0.1

α

= −120◦



m = +1;

+ 360◦

⎪ ◦ ⎪ ⎪ ⎩ β = −70 , σ = +170◦ .

= 240◦ ,

Fig. 4(b):

⎧ a = −0.1 ⎪ ⎪ ⎪ ⎨ b = −1.7

α

α is to be corrected, and β for the path ⇒

m = −1;

= 150◦ ,

⎪ ◦ ◦ ◦ ⎪ ⎪ ⎩ β = 150 − 360 = −210 , ◦ σ = −60 .

Step 3. Calculate σ = α + β . Check inequality |σ |  π . If it is not satisfied, the algorithm does not work. It is always possible to split the designed path (Section 9 in Kurnosenko, 2010) and to apply the algorithm to each subpath. Step 4. Find L,

ω from (12), r0 , λ0 from (13). Get the sought for spiral (14).

5. Illustrations The possibility to construct long curves was not mentioned in the description of the parabolic algorithm (Kurnosenko, 2010). But it obeys the same theory. In Fig. 4(b) the G2 data is such that the parabolic algorithm is applicable, providing two solutions, additional to the hyperbolic one. In Fig. 5 (top) three adjacent arcs of Cornu spiral are chosen such as to be critical for the method. This means that the hyperbolic arcs include vertices at the endpoints. The curvature plot bears evidence of these might-have-been vertices as the horizontal tangents to the plot at the joining points. This feature disappears in the bottom picture, where the whole arc is split into six segments. Among the examples in Fig. 6 there are G2 Hermite data with the boundary circles of curvature close to tangency; Q is close to zero, interpolating curve is close to a biarc. One can observe a sudden, but smooth, change from the curvature of one circle to the curvature of the other circle, similar to curvature jump in a natural equation of a biarc. 6. Conclusions Note that it is possible to match much wider range of G1,2 Hermite data by inversions of other curves. In particular, transcendental curves, obtained by inversions of logarithmic spiral, match any |σ | > 0 and any Q < 0. Fig. 7 shows some examples. The first one “interpolates” in G2 manner the whole, not split, arc of Cornu spiral C 1 C 6 , previously shown in

480

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

Fig. 6. Examples of two-point G2 Hermite interpolation by inversions of hyperbola. Parabolic solutions, where they exist, are shown by dotted lines.

Fig. 7. Solutions for big |σ |, obtained by inversion of logarithmic spiral (without splitting a path). G2 Hermite data are those of Cornu spiral (dotted line).

A.I. Kurnosenko / Computer Aided Geometric Design 27 (2010) 474–481

481

Fig. 5. For this arc σ = 5π . Solutions for big σ are interesting from the theoretical point of view, rather than that of CAD applications. Three other examples are for σ = 2π , σ = 3π . Theoretical background and proposed solutions show that C -shaped and S-shaped spiral arcs obey the common theory. Usually there is no need in their separate treatment. References Kurnosenko, A.I., 2009. Long spirals. Zapiski Nauch. Sem. POMI 372, 44–52. Kurnosenko, A.I., 2010. Applying inversion to construct planar, rational, spiral curves that satisfy two-point G2 Hermite data. Comp. Aided Geom. Design 27, 262–280.