+ All Categories
Home > Documents > Interpolation of two-dimensional curves with Euler spirals

Interpolation of two-dimensional curves with Euler spirals

Date post: 30-Dec-2016
Category:
Upload: lilia
View: 219 times
Download: 0 times
Share this document with a friend
13
Journal of Computational and Applied Mathematics 261 (2014) 320–332 Contents lists available at ScienceDirect Journal of Computational and Applied Mathematics journal homepage: www.elsevier.com/locate/cam Interpolation of two-dimensional curves with Euler spirals Dale Connor, Lilia Krivodonova University of Waterloo, Waterloo, Ontario, Canada article info Article history: Received 20 April 2012 Received in revised form 11 September 2013 Keywords: Euler spirals Cornu spirals G 1 interpolation abstract We propose an algorithm for the interpolation of two-dimensional curves using Euler spirals. The method uses a lower order reconstruction to approximate solution derivatives at each sample point. The computed tangents are then used to connect consecutive points with segments of Euler spirals. The resulting interpolation is G 1 in regions where the curve being interpolated is smooth. The algorithm uses an adaptive stencil which allows it to construct an approximation free of oscillations near discontinuities in the function or its derivatives. The approximation is based on geometrical shapes which makes it particularly suitable for two-dimensional curves. Crown Copyright © 2013 Published by Elsevier B.V. All rights reserved. 1. Introduction We propose an algorithm for interpolation of two-dimensional curves, i.e., curves that cannot be represented by a one- to-one function y(x), with Euler spirals. The main features of the algorithm are independence of a coordinate system, local character of approximation, and smoothness of the resulting interpolant. Given an ordered set of points (x i , y i ), the algorithm connects pairs of neighboring points with Euler spirals. The interpolant is G 1 with the exception of points where the algorithm selectively places a discontinuity in the tangent. The Euler spiral is a curve with curvature changing linearly with the arclength. Planar spirals have attractive properties such as monotone curvature and absence of singularities. They are used as approximations as well as transitions between circular and linear segments in a variety of applications. Euler spirals are traditionally employed in highway and railway route design [1]. And more recently, in path generation for high speed machinery [2] and image completion in computer graphics [3]. The motivation for this research came from the previous work of one of the authors on the implementation of high- order accurate boundary conditions for compressible flows in complex geometries [4]. The standard method of imposing boundary conditions at solid walls is to require that no flow passes through the numerical boundary. The numerical boundary is comprised of edges of a triangular or quadrilateral mesh such as, for example, a mesh around a NACA0012 airfoil in Fig. 1. The curved surface of the airfoil is imperfectly approximated by the straight edges of the triangular mesh. This results in a large error committed near the surface which then propagates through the domain (Fig. 2, left). It was shown that higher order finite element methods such as the discontinuous Galerkin method are significantly affected by this boundary effect. Krivodonova et al. [4] proposed to use curved boundary conditions which resulted in no flow passing through the physical boundary. This was done by incorporating normals to the physical wall into the computation of the flux on the numerical boundary. The normals can be obtained by reconstructing the physical surface from the edges forming the numerical boundary. Approximating the physical boundary on each edge with circular arcs and using normals to these arcs as an approximation to the true physical normals resulted in a great improvement in computations as compared with the traditional implementation of boundary conditions (Fig. 2). Corresponding author. Tel.: +1 5198884567. E-mail address: [email protected] (L. Krivodonova). 0377-0427/$ – see front matter Crown Copyright © 2013 Published by Elsevier B.V. All rights reserved. http://dx.doi.org/10.1016/j.cam.2013.11.009
Transcript
Page 1: Interpolation of two-dimensional curves with Euler spirals

Journal of Computational and Applied Mathematics 261 (2014) 320–332

Contents lists available at ScienceDirect

Journal of Computational and AppliedMathematics

journal homepage: www.elsevier.com/locate/cam

Interpolation of two-dimensional curves with Euler spiralsDale Connor, Lilia Krivodonova ∗

University of Waterloo, Waterloo, Ontario, Canada

a r t i c l e i n f o

Article history:Received 20 April 2012Received in revised form 11 September2013

Keywords:Euler spiralsCornu spiralsG1 interpolation

a b s t r a c t

We propose an algorithm for the interpolation of two-dimensional curves using Eulerspirals. The method uses a lower order reconstruction to approximate solution derivativesat each sample point. The computed tangents are then used to connect consecutive pointswith segments of Euler spirals. The resulting interpolation is G1 in regions where the curvebeing interpolated is smooth. The algorithm uses an adaptive stencil which allows it toconstruct an approximation free of oscillations near discontinuities in the function or itsderivatives. The approximation is based on geometrical shapes whichmakes it particularlysuitable for two-dimensional curves.

Crown Copyright© 2013 Published by Elsevier B.V. All rights reserved.

1. Introduction

We propose an algorithm for interpolation of two-dimensional curves, i.e., curves that cannot be represented by a one-to-one function y(x), with Euler spirals. The main features of the algorithm are independence of a coordinate system,local character of approximation, and smoothness of the resulting interpolant. Given an ordered set of points (xi, yi), thealgorithm connects pairs of neighboring points with Euler spirals. The interpolant is G1 with the exception of points wherethe algorithm selectively places a discontinuity in the tangent.

The Euler spiral is a curve with curvature changing linearly with the arclength. Planar spirals have attractive propertiessuch as monotone curvature and absence of singularities. They are used as approximations as well as transitions betweencircular and linear segments in a variety of applications. Euler spirals are traditionally employed in highway and railwayroute design [1]. And more recently, in path generation for high speed machinery [2] and image completion in computergraphics [3].

The motivation for this research came from the previous work of one of the authors on the implementation of high-order accurate boundary conditions for compressible flows in complex geometries [4]. The standard method of imposingboundary conditions at solidwalls is to require that no flowpasses through thenumerical boundary. Thenumerical boundaryis comprised of edges of a triangular or quadrilateral mesh such as, for example, a mesh around a NACA0012 airfoil inFig. 1. The curved surface of the airfoil is imperfectly approximated by the straight edges of the triangular mesh. This resultsin a large error committed near the surface which then propagates through the domain (Fig. 2, left). It was shown thathigher order finite element methods such as the discontinuous Galerkin method are significantly affected by this boundaryeffect. Krivodonova et al. [4] proposed to use curved boundary conditions which resulted in no flow passing through thephysical boundary. This was done by incorporating normals to the physical wall into the computation of the flux on thenumerical boundary. The normals can be obtained by reconstructing the physical surface from the edges forming thenumerical boundary. Approximating the physical boundary on each edge with circular arcs and using normals to thesearcs as an approximation to the true physical normals resulted in a great improvement in computations as compared withthe traditional implementation of boundary conditions (Fig. 2).

∗ Corresponding author. Tel.: +1 5198884567.E-mail address: [email protected] (L. Krivodonova).

0377-0427/$ – see front matter Crown Copyright© 2013 Published by Elsevier B.V. All rights reserved.http://dx.doi.org/10.1016/j.cam.2013.11.009

Page 2: Interpolation of two-dimensional curves with Euler spirals

D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332 321

Fig. 1. Mesh around NACA0012.

Fig. 2. Mach isolines for a simulation of subsonic flow around a circular cylinder with reflective (left) and curvature (right) boundary conditions. Thereflective boundary conditions result in a large unphysical wake at the back of the cylinder.

We propose to use Euler spirals to obtain a more accurate reconstruction of normals to the two-dimensional boundary.The new reconstruction is more accurate than an interpolation using circular arcs and is G1 in smooth regions. Thus, thenormal to the surface is a continuous functionwhich can be an important factor in aerodynamical simulations. Furthermore,the normal and curvature of the interpolating curve can be easily obtained at any point. Non-lagrangian approximation ofcurved boundaries has been used in finite element codes. For example, approximation with splines [5] or NURBS [6,7] forused in simulation ofNavier–Stokes or Euler equation. However, this approach assumes the availability of high-ordermeshesincorporating cells with curved sides and introduces its own difficulties such as numerical integration on curvedmesh cells.We note that our approach is different as we assume that high-order accuracy approximation is not available and insteadseek to locally reconstruct a more accurate normal to the true geometry on a straight-sided mesh.

The idea of approximating two-dimensional curves with circular arcs was also proposed in [8] by Siddiqi et al. The stencilfor constructing an interpolant between points Pi−1 and Pi was chosen adaptively with the third point needed to create acircle chosen from Pi−2 and Pi+1. The circle used in interpolationwas the onewith the smallest curvature. This idea is similarto the adaptive stencil of essentially non-oscillatory (ENO) schemes [9] used in the numerical solution of partial differentialequations and the resulting method was named the geometrical essentially non-oscillatory scheme (GENO). Siddiqi et al.suggested that Euler spirals could be used for constructing a higher order GENO interpolation. This would seem to be anatural choice as Euler spirals can be thought of as the next geometrical shape function. The simplest geometric shape is acurve with zero curvature, i.e., a line. It is followed by a curve with a constant curvature, a circle. An Euler spiral would bethe next shape since its curvature changes linearly with the arclength. However, this idea is difficult to implement as thereseems to be no existing algorithm for passing an Euler spiral through four ordered points.

The proposed algorithm takes a hierarchical approach to interpolation. First, we pass three circles through each samplepoint, Pi, using the stencils: {Pi−2, Pi−1, Pi}, {Pi−1, Pi, Pi+1}, {Pi, Pi+1, Pi+2}. The circle with the smallest curvature is takenas a low order approximation at point Pi. Then, the interpolation between points Pi−1 and Pi is computed by finding anEuler spiral passing through these points such that the tangents to the spiral coincide with the tangents to the local circularapproximations at Pi−1 and Pi. Since the tangent at Pi is shared by segments (Pi−1, Pi) and (Pi, Pi+1), the interpolation is G1.The spiral is constructed using an algorithm of Meek and Walton [10,11].

Euler spirals were previously used for shape completion by Kimia et al. [3], where the missing part of a shape wasreconstructed using the slopes at the end points of the missing interval. They also argued that ‘‘the most pleasing curve’’ isthe curvewith the smallest change in curvature and notwith theminimal curvature. It was demonstrated that an Euler spiral

Page 3: Interpolation of two-dimensional curves with Euler spirals

322 D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332

is a curve that satisfies the above requirement. This is in contrast with the GENO approach which chooses the flattest curve.Our algorithm combines the ideas expressed in [8,3] by first looking for the stencil giving the smoothest approximationand then using ‘‘the most pleasing’’ reconstruction in that region. Another interpolation method based on Euler spirals wasproposed by Stoer [12]. The interpolant is in G2 but the method requires solving a global system of equations and would notbe suitable for function with discontinuities in first derivatives.

The proposed algorithm is able to construct accurate approximations of functions with discontinuities, that is, functionswith jumps in the solution or its derivatives. The interpolant on the interval (Pi−1, Pi) uses information from one to fouradditional nearby points and chooses the stencil which forms the local approximation with lowest curvature. This processprevents segments containing discontinuities from affecting neighboring intervals and stops oscillations from propagatingthrough the domain. In addition to the choice of points involved, the size of the stencil also changes adaptively.When a shock,that is a discontinuity in the function or its derivative, is present and needs to be resolved, we allow the two interpolantsmeeting at Pi to have different tangents. Themethod determines at which sample points placing a shock is appropriate. Thisallows us to accurately resolve sharp corners such as the tail of an airfoil (Fig. 1). The small stencil and local interpolationelement by element is also convenient for the reconstruction of the physical boundary from a computational mesh since aglobal reconstruction may be difficult to use with the data structures in finite element codes.

An additional advantage of using geometrical shapes as interpolants is their independence of a coordinate system. Cubicsplines are a popular choice for interpolation, however, finding a good parametrization for a polynomial interpolation maybe difficult. A bad choice may lead to oscillatory behavior even for relatively smooth functions. The arclength can serve asa good parameter but it is not known prior to the interpolation. Using standard interpolation techniques in a local rotatedcoordinate system may not be robust for curves which change direction rapidly as it might be difficult to find a coordinatesystem where the curve is one to one. In addition, when a curve has a sharp corner, fixed-stencil polynomial interpolationtechniques produce oscillations [13].

The paper is organized as follows.We begin by explaining the basic properties of an Euler spiral in Section 2. In Section 3,we summarize the algorithm for fitting spirals proposed by Walton and Meek in [10]. In Section 4, we introduce ourinterpolation method. Lastly, a number of numerical experiments are presented in Section 5.

2. Introduction to spirals

An Euler spiral, also known as a Cornu spiral or a clothoid, is a two-dimensional curve with a curvature that changeslinearly as a function of the arclength. A canonical Euler spiral is described by the following parameterized form

x(α)y(α)

=

C̄(α)S̄(α)

, (1)

where C̄(α) and S̄(α) are given by

C̄(α) =1

√2π

α

0

cos(u)√u

du, S̄(α) =1

√2π

α

0

sin(u)√u

du, (2)

for α > 0. For negative values of α, we take C̄(α) = −C̄(−α) and likewise for S̄. In these equations, |α| is the angle betweenthe tangent and the positive x-axis. The expressions (2) were derived from the cosine and sine Fresnel integrals

C(t) =

t

0cos

πu2

2

du, S(t) =

t

0sin

πu2

2

du (3)

using a change of variable α = ±π t22 .

By construction, positive values of parameters t and α correspond to the right half of the spiral, the negative values tothe left half, and t = 0 and α = 0 to the origin (Fig. 3). The expressions (2) and (3) are related by

C̄π t2

2

= C(t), S̄

π t2

2

= S(t). (4)

It follows from (3) that the arclength between a point (x(t), y(t)) = (C(t), S(t)) and the origin is equal to |t|. Differentiating(1) with respect to α (α > 0) yields

x′(α)y′(α)

=

1√2πα

cos(α)sin(α)

. (5)

This demonstrates that α is the angle formed by the tangent to the curve at point (C̄(α), S̄(α))with the x-axis. The angle ismeasured in the counter-clockwise direction from the axis to the tangent vector. In terms of parametrization (3), the angleat point (C(t), S(t)) is given by π t2/2.

Page 4: Interpolation of two-dimensional curves with Euler spirals

D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332 323

Fig. 3. An Euler spiral as defined by (1) with α values labeled.

Fig. 4. Two point G1 Hermite data.

The canonical Euler spiral can be scaled by a factor a, rotated by an angle ψ and translated to a point (x0, y0). Thus, anarbitrary Euler spiral can be described as

x(α)y(α)

= a

cos(ψ) − sin(ψ)sin(ψ) cos(ψ)

C̄(α)S̄(α)

+

x0y0

. (6)

Or, equivalently,

P̄(α) = P̄0 + aC̄(α)T⃗0 + aS̄(α)N⃗0, (7)

where T⃗0 = (cosψ, sinψ)T and N⃗0 = (− sinψ, cosψ)T are the unit tangent and normal vectors to the spiral at P0. This canbe rewritten in terms of parameter t as:

P̄(t) = P̄0 + aC(t)T⃗0 + aS(t)N⃗0. (8)

The center of the spiral corresponds to t = 0 and is located at P0 = (x0, y0). At the center, the curvature is equal to zero andψ is the angle between the tangent vector and the x-axis (Fig. 5). The length of the curve from P0 to point (x(t), y(t)) is equalto a|t|. From geometrical considerations, the angle from the positive x-axis to the tangent at point (x(t), y(t)) is equal to thesum of the angle of rotation and α, i.e. ψ + π t2/2. Differentiating this with respect to arclength, we obtain the curvature κ

κ =π ta. (9)

This demonstrates that the curvature of an Euler spiral at a point is indeed proportional to the arclength from P0. For positivet , curvature is positive and the spiral is rotating counterclockwise as t increases; for negative t , curvature is negative andthe spiral is rotating clockwise as t increases.

3. Algorithm for finding a spiral

Any two given points P1 and P2 with associated tangent vectors T⃗1 and T⃗2 can be connected by an Euler spiral such thatthe tangent vector of the spiral matches the prescribed tangents at both points (Fig. 4). In fact, there exists a countablenumber of Euler spirals satisfying the above conditions [3]. We are interested in the spiral with the shortest arclength thatwill interpolate the data without completing a full coil. Kimia et al. [3] proposed an algorithm for finding such a spiral. Later,Walton and Meek [14,10] proposed a different solution to this problem which we used in our implementation. Here webriefly summarize the implementation of their algorithm for use in our problem. The algorithm constructs an Euler spiralto solve the interpolation problem using the central region characterized by α ∈ [−π, 2π ].

First, we check if the data can be connected with a straight line or a circle. These can be thought of as degenerate cases ofEuler spirals. Otherwise, the following is applied. We distinguish between two cases, an S-shaped segment and a C-shapedsegment. An S-shaped segment contains the inflection point P0 (Fig. 5, right). A C-shaped segment is located entirely on one

Page 5: Interpolation of two-dimensional curves with Euler spirals

324 D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332

Fig. 5. A C-shaped segment with completion extended back to P0 (left) and an S-shaped segment (right). The spiral completions are shown as dashed lines.

side of P0 (Fig. 5, left). Let D⃗ be the vector from starting point P1 to end point P2. Denote by φ1 the angle from the tangent T⃗1to D⃗ and by φ2 the angle from D⃗ to the tangent T⃗2, both measured counter-clockwise.

The algorithm assumes that φ1 and φ2 satisfy the following two conditions:

1. |φ2| ≥ |φ1|

2. 0 ≤ φ2 ≤ π .

If these are notmet, the problem is adjusted to satisfy them. If the first condition is violated, the spiral needs to be constructedin the opposite direction, from P2 to P1. To remain consistent with the original data, we need to set φ1 = −φ2 and φ2 = −φ1.If the second condition is notmet, the data needs to be reflected over D⃗. This is achieved by setting φ1 = −φ1 and φ2 = −φ2.The spiral obtained by the algorithm will need to be reflected back over D⃗ for it to satisfy the initial data.

To construct a spiral described by (7), the values of P0, a, T⃗0, and N⃗0 need to be determined. In addition, values of parameterα corresponding to points P1 and P2 must be found.

First, we determine the type of interpolating segment. A C-shaped solution exists only when two conditions are met:0 < φ1 < φ2 < π and h(φ1, φ2) < 0, where

h(φ1, φ2) = S(φ1 + φ2) cos(φ1)− C(φ1 + φ2) sin(φ1). (10)

If h(φ1, φ2) > 0 or φ1 < 0 the solution will be an S-shaped segment.

3.1. C-shaped segments

We start by computing the value of θ , the angle between T⃗0 and T⃗1, the tangent vectors at points P0 and P1, respectively.The sought θ is the solution of

f (θ) = 0 (11)

in the interval [0, θMAX ], where

f (θ) = (S̄(θ + φ1 + φ2)− S̄(θ)) cos(θ + φ1)− (C̄(θ + φ1 + φ2)− C̄(θ)) sin(θ + φ1), (12)

θMAX =λ2(φ1 + φ2)

1 − λ2, (13)

and

λ =1 − cos(φ1)

1 − cos(φ2). (14)

The Eq. (11) can be solved using Newton’s method combined with bracketing. Having obtained θ , we compute a as

a =∥D⃗∥2

S̄(θ + φ1 + φ2)− S̄(θ)sin(θ + φ1)+

C̄(θ + φ1 + φ2)− C̄(θ)

cos(θ + φ1)

, (15)

Page 6: Interpolation of two-dimensional curves with Euler spirals

D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332 325

where ∥D⃗∥2 is the length of D⃗. T⃗0 can be calculated by rotating the vector D⃗ by an angle θ + φ1 clockwise, N⃗0 is obtained byrotating T⃗0 by π/2, also clockwise:

T⃗0 =

cos(θ + φ1) sin(θ + φ1)− sin(θ + φ1) cos(θ + φ1)

D⃗

∥D⃗∥, N⃗0 =

0 1

−1 0

T⃗0. (16)

If the spiral needs to be reflected back over D⃗, we reflect T⃗0 and N⃗0 over D⃗:

T⃗0 =

cos(−θ − φ1) sin(−θ − φ1)

− sin(−θ − φ1) cos(−θ − φ1)

D⃗

∥D⃗∥, N⃗0 =

0 −11 0

T⃗0. (17)

P0 can be calculated from (7) by using the substitution P(θ) = P1. The interpolation between points P1 and P2 is now givenby the segment of the spiral with α ∈ [θ, θ + φ1 + φ2].

3.2. S-shaped segments

With an S-shaped solution, the points P1 and P2 will be on opposite sides of the central point, P0. We choose P1 tocorrespond to a negative value of α, and P2 to a positive one. Similar to the previous section, we first compute the valueof θ as a solution of

g(θ) = 0, (18)

where

g(θ) = (S̄(θ + φ1 + φ2)+ S̄(θ)) cos(θ + φ1)− (C̄(θ + φ1 + φ2)+ C̄(θ)) sin(θ + φ1). (19)

If φ1 > 0, we choose the zero of (18) in the interval [0, π/2 − φ1]; otherwise, in the interval [−φ1, π/2 − φ1]. We obtain afrom

a =∥D⃗∥2

(S̄(θ + φ1 + φ2)+ S̄(θ)) sin(θ + φ1)+ (C̄(θ + φ1 + φ2)+ C̄(θ)) cos(θ + φ1). (20)

Next, the vectors T⃗0 and N⃗0 are calculated by rotating D⃗ by θ + φ1 using (16) and (17). P0 is calculated from (7) using thesubstitution P(−θ) = P1. The interpolating segment of the spiral is now defined by (7) with α ∈ [−θ, θ + φ1 + φ2].

3.3. Evaluation of Fresnel integrals

Fresnel integrals used in the description of Euler spirals need to be evaluated numerically. Integration of the Taylor seriesexpansions of sine and cosine give [15,16]

C(t) =

∞n=0

(−1)n(π2 )2n

(2n)!(4n + 1)t4n+1, S(t) =

∞n=0

(−1)n(π2 )2n+1

(2n + 1)!(4n + 3)t4n+3. (21)

These series (21) converge quickly for small t . We observe that the algorithm of Section 3 only utilizes angles between −π

and 2π . Since the angle is equal to π t2/2, this is equivalent to t values between −√2 and 2. Calculations can be sped up for

small t by precomputing the coefficients in front of t4n+1 and t4n+3

cn =(−1)n(π2 )

2n

(2n)!(4n + 1), sn =

(−1)n(π2 )2n+1

(2n + 1)!(4n + 3). (22)

These are given by

c⃗ = (1,−2.46E − 01, 2.82E − 02,−1.60E − 03, 5.41E − 05,−1.20E − 06,1.88E − 08,−2.20E − 10, 1.99E − 12,−1.43E − 14, 8.38E − 17) (23)

and

s⃗ = (5.24E − 01,−9.23E − 02, 7.24E − 03,−3.12E − 04, 8.44E − 06,−1.56E − 07,2.11E − 09,−2.16E − 11, 1.73E − 13,−1.12E − 15, 5.98E − 18). (24)

In this case, computing of the integrals becomes a vector by vector multiplication with the error bound given by the nextterm in the series for t < 1. For a large t , care must be taken to avoid cancellation errors.

An alternate method for evaluating Fresnel integrals using rational approximation is presented in [17].

Page 7: Interpolation of two-dimensional curves with Euler spirals

326 D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332

Fig. 6. Computing the tangent vector at P3 . Three circles pass through P3: {P1, P2, P3} (solid), {P2, P3, P4} (dashed), and {P3, P4, P5} (dotted). The tangent isobtained from the largest circle {P1, P2, P3}.

Fig. 7. Two possible spiral completions using T⃗2 (left) and −T⃗2 (right).

4. Approximation of tangent vectors

We describe an algorithm for the interpolation of two-dimensional curves with Euler spirals. Let us assume that we aregiven an ordered set of sample points Pi = (xi, yi), i = 1, 2, . . . ,N . In order to apply the algorithm of Section 3, additionaldata are needed, i.e., a tangent vector at each sample point. These are obtained from a local lower order approximation ofthe curve by circles.

We define the tangent T⃗i at Pi as the tangent to a circle passing through Pi and two nearby points. We consider threestencils: {Pi−2, Pi−1, Pi}, {Pi−1, Pi, Pi+1}, and {Pi, Pi+1, Pi+2} and choose the stencil corresponding to the circle with thesmallest curvature, or equivalently, the largest radius (Fig. 6). Thus, the stencil is chosen adaptively to select a well-behavedlocal approximation for the data and resists influence from points which could cause undesirable oscillations. For example,in Fig. 6 the stencil corresponding to {P3, P4, P5} would lead to the creation of spurious oscillations between points P2 andP4. Either of the other two stencils produce an admissible approximation to the local behavior at P3, but the chosen stencil({P1, P2, P3}) has a lower curvature.

For a given circle, we can compute two tangent vectors at each point corresponding to two orientations of the circle. Wechoose the tangent vector pointing in the direction of increasing indices on the set of sample points. For this to hold, werequire

D⃗i · T⃗i > 0 and D⃗i+1 · T⃗i > 0, (25)

where D⃗i is the vector connecting Pi−1 to Pi, i = 1, 2, . . . ,N . If both these conditions are not met, the corresponding tangentvector should be rotated by π radians. This is illustrated in Fig. 7. In the figure, there are two possible choices at P2, T⃗2 and−T⃗2. The choice of −T⃗2 causes the interpolant to make a ‘‘U-turn’’ and forces the curve to point in the wrong direction atthe end point (Fig. 7, right). This is undesirable as the curve on the left is clearly smoother than the curve on the right. Ifboth conditions cannot be met simultaneously, we treat this case as an exception the handling of which will be discussedlater.

Once the tangents are computed, we use themethod of Section 3 for each pair of points Pi−1 and Pi and the correspondingtangents T⃗i−1 and T⃗i to construct the interpolating segment between the points. The union of all interpolating segments formsthe interpolating curve. By construction, this curve is G1 for well behaved data since at each point Pi the tangent vector tothe segments sharing Pi is equal to T⃗i.

In some situations, a more accurate approximation can be formed by permitting a discontinuity in the tangent vector.This is the case when the conditions (25) cannot be satisfied simultaneously. In this situation, we place a shock at point Pi.That is, rather than attempt to find a smooth interpolation in this region, we use two different tangents at Pi. The tangentfor the (Pi−1, Pi) interval is obtained from the stencil {Pi−2, Pi−1, Pi}. Similarly, the tangent at Pi for the (Pi, Pi+1) interval iscomputed from the {Pi, Pi+1, Pi+2}. As a result, shocks are placed at specific points along the interpolation allowing sharpcorners and cusps to be approximated. These situations are demonstrated in Figs. 8 and 9 respectively.

Page 8: Interpolation of two-dimensional curves with Euler spirals

D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332 327

Fig. 8. A discontinuous tangent vector will be used in the approximation at point Pi if the chosen tangent vector is parallel to Di since γ > π/2. Thetangent vector approximating the (Pi, Pi+1) interval will be collected separately. The resulting interpolation should form a sharp corner at Pi (assumingPi+2 is positioned reasonably).

Fig. 9. Point Pi will need to have two tangent vectors defined since γ1 < π/2 and γ2 < π/2. As a result, D⃗i · T⃗i > 0 while D⃗i+1 · T⃗i < 0, so the requiredconditions to place a discontinuous tangent vector are met. The interpolation will form a cusp at Pi .

Table 1L2 errors of the two methods applied to cos

2πx5

on x ∈ [−5, 5] with N sample points.

N Spirals SplinesError r Error r

11 2.80E−01 – 2.11E−2 –21 4.31E−02 2.67 2.60E−03 3.0241 6.50E−03 2.73 1.41E−04 4.281 9.63E−04 2.75 6.65E−06 4.4

161 1.53E−04 2.65 3.13E−07 4.41

5. Numerical examples

In this section, we provide numerical examples of approximating two-dimensional data with Euler spirals and comparethe results with cubic splines and GENO interpolations. Spline interpolations were computed using the MATLAB functionspline().

5.1. Example 1

We perform a convergence test on the interval [−5, 5] for y = cos(2πx/5) and report the results in Table 1. Theobserved rate of convergence is around 2.7. The spiral approximation is less accurate than cubic splines for this smoothone-dimensional problem as expected.

5.2. Example 2

We apply the three algorithms to a set of sample points representing a step function. As expected, cubic splines exhibitspurious oscillations extending far from the discontinuity. GENO and spiral interpolations result in a monotone datareconstructionwith no visible overshoots in y-direction. The spirals result in a smoother reconstruction than GENO since thetangents at x = 10, x = 10.5 are continuous. The GENO reconstruction has an abrupt jump in the first derivative at thesepoints. Even without the subpixel interpolation of discontinuous data, the spiral interpolation captures the discontinuity inone element and results in a visually pleasing approximation. We also note that the discontinuity in the function affects thespiral interpolation only on the interval containing the jump. The other segments are not influenced by the shock, as theadaptive stencil chooses only sample points to the left or right of the discontinuity (see Fig. 10).

Page 9: Interpolation of two-dimensional curves with Euler spirals

328 D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332

Fig. 10. Cubic splines, GENO and the spiral algorithm applied to a step-function.

Fig. 11. Interpolations of the NACA0012 airfoil.

Fig. 12. Zoom of the NACA0012 airfoil’s tail. GENO and spiral interpolations in this region are equal and are shown as solid lines, cubic splines representedby dashed lines.

5.3. Example 3

Next, we apply the three methods to a NACA0012 airfoil, the surface of which is given by

y = ±5t(0.2969√x − 0.126x − 0.3516x2 + 0.2843x3 − 0.1015x4), (26)

with t = 0.12. The airfoil is a closed curve and cannot be expressed as a single valued function. We use parameterized cubicsplines with the index j of point Pj as a parameter value, i.e., (x(j), y(j)) = Pj, j = 1, 2, . . . ,N . We then obtain a cubic splineapproximation of x(t) and y(t) by interpolating them separately. With 38 sample points, all three interpolations appearto be very accurate (Fig. 11). The only visible discrepancy from the actual airfoil occurs right at the tail where the airfoilcomes to a sharp point (Fig. 12). This is a feature cubic splines are unable to simulate. We observe that cubic splines resultin smoothing of the tail of the airfoil, whereas both GENO and the proposed algorithm capture the desired behavior. Wecomputed the L2 errors in parameterized splines, one-dimensional splines, GENO and spiral interpolations with 80 samplepoints. The results are 7.22E − 04, 2.2E − 03, 3.90E − 04, and 3.76E − 05, respectively. In this example, Euler spiralsprovide the smallest error. The large error in parameterized splines comes from a poor approximation of the tail. The one-dimensional splines (regular splines applied to upper and lower halves of the airfoil separately) generated a large errordue to the inability to estimate and meet the boundary conditions. One could apply a local interpolation method such asthe piecewise continuous hermite interpolating polynomials to this problem, however the result with this method would

Page 10: Interpolation of two-dimensional curves with Euler spirals

D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332 329

Fig. 13. Pressure contours for a flow around the NACA0012 airfoil.

Fig. 14. Cubic spline (top), spiral (middle) and GENO (bottom) interpolations applied to a random set of sample points.

encounter the same smoothing problem as parameterized splines at the end of the wing. In Fig. 13 we plot pressure isolinesfor the flow with free flow Mach number equal to 0.38. The isolines are smooth and numerical irregularities like ones inFig. 2, left, are not present.

5.4. Example 4

This example compares the interpolations resulting from the three methods applied to a set of randomly generated data.The x coordinates are 0, 1, . . . , 30, and the y coordinates were obtained using the rand() function inMATLAB. The results areplotted in Fig. 14, the solutions are translated vertically for easy comparison. In this example it is difficult to claim that onemethod provides a more accurate solution than another. The cubic spline interpolation (top) is very smooth and featuresoscillatory behavior, most noticeably around x = 10 and x = 25. The GENO interpolation (bottom) has sharp corners, butno oscillatory behavior. In the middle is the interpolation consisting of spiral segments. We see one point (x = 19) featuringa discontinuity in tangent as discussed in Section 4. It appears that the spiral approximation possesses positive attributes ofthe other two methods because the interpolation is smooth and oscillations are not visible.

5.5. Example 5

This example demonstrates the robustness of spiral approximations for two dimensional data. We apply cubic splinesand spiral interpolations to a set of ordered points representing the outline of a hand [18]. We demonstrate that the choiceof parametrization influences the accuracy of spline approximations.

We use two parameterizations. The first, naive parametrization is to use the index j of point Pj as a parameter value,i.e. (x(j), y(j)) = Pj, j = 1, 2, . . . ,N . For the second parametrization we use polar coordinates. This approach uses thestarlike property of this data set to provide a single valued function r(θ) where ri is the distance measured from a fixedpoint PF = (P1 + PN)/2 to each sample point and θi is the angle between the positive x-axis and the line connecting thesample point Pi and PF . We apply cubic spline interpolation to points [θj, rj], j = 1, 2, . . . ,N .

The first cubic splines approximation seems to be accurate. The ‘‘naive’’ parametrization works well in this case becausethe points are relatively equally spaced. The poor approximation comes from interpolating r(θ) because in some regionssmall changes in θ result in large changes in r . Splines tend to oscillate in regions like this.

The spiral algorithm does not require a parametrization or a single valued function to interpolate since it relies ontwo dimensional geometric shapes. The largest difference between the successful cubic spline interpolation and the spi-ral interpolation seems to be in the regions between fingers. Again, the spirals allow the interpolation to come to a pointwhereas the splines smooth out these areas. Given such few sample points, either behavior at these points appears valid(see Fig. 15).

Page 11: Interpolation of two-dimensional curves with Euler spirals

330 D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332

Fig. 15. Completions of a hand using spirals (left) and two different cubic spline methods (right). In the right plot, the dashed line corresponds to theapproximation using a polar coordinates parametrization, and the solid line corresponds to the parametrization using indices.

Fig. 16. Lake Opeongo. Left: outline of the lake. Right: adaptive Cartesian grid.

5.6. Example 6

In this example, we apply our algorithm to a realistic and complex geometry. We use it for the reconstruction of theboundary and two-dimensional mesh generation for the lake Opeongo located in the northeastern Ontario. The geometricaldescription of the lake was obtained from bathymetry measurements by the Ontario Ministry of the Environment andprovided by Harkness Laboratory of Fisheries Research. The bathymetric data were sampled every 200 m with the totalarea of the lake being 5.8 square kilometers. The input for the mesh generator is the zero-contour of the bathymetry whichconsists of 745 points including the points used to describe small islands inside the lake. Our Cartesian mesh generatoris similar to the NASA’s Cart 3D mesh generator [19] and has adaptive capabilities. The mesh is needed to model thelake dynamics. To accurately and efficiently resolve the problem, we need to concentrate small cells in regions where thegeometry and the solution change rapidly. By concentrating cells where they are needed the most we are able to reducethe total number of cells and, hence, the computing time. In this example, the regions marked for refinement would be theregions near the lake shore and islands. The adaptive process is driven by numerical estimation of the local curvature ofthe geometry. In this example, we used five levels of refinement, i.e. we have cells of size h, h/2, . . . , h/32. In Fig. 16, weshow a spiral reconstruction of the lake shore and the overall view of the mesh. Darker regions on the plot correspond toa highly refined mesh. A close up of the mesh near one of the islands is shown in Fig. 17, right. The mesh generator startsfrom a uniform Cartesian grid and then cuts out the embedded geometry producing small irregular cells in the process.Two more close-ups of reconstruction of the lake shore are shown in Fig. 18 with dots corresponding to the data points andlines showing the reconstruction. We observe that Euler spiral approximation results in a good representation of the lakegeometry. Even a small island described by only four points has a reasonable shape Fig. 18, right.

6. Discussion and conclusions

The proposed algorithm reconstructs a two-dimensional curve from a set of ordered sample points. The approximationis constructed independently on each segment (Pi−1, Pi) by using Euler spirals. The distinct features of the algorithm are theG1 continuity of the interpolant in the smooth regions and the lack of oscillations near function discontinuities. In fact, onlythe interpolation in the segments containing a discontinuity are affected by it. This is achieved by employing an adaptive

Page 12: Interpolation of two-dimensional curves with Euler spirals

D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332 331

Fig. 17. Lake Opeongo, zoom near an island. Left: boundary reconstruction. Right: adaptive Cartesian grid.

Fig. 18. Lake Opeongo. Left: a close-up of a lake shore approximation. Right: approximation of a small island.

stencil and enforcing continuity of tangents at the sample points. In our numerical experiments, the convergence rate ofinterpolation was slightly below three. However, the method can be more accurate than splines even for one-dimensionalinterpolation of a smooth function as was demonstrated in Example 3.

Our main goal was to construct an accurate interpolation of a physical geometry given a mesh around it. The ability ofthe method to provide an accurate approximation near the front and the tail of the airfoil is of great importance as theflow simulations are especially sensitive to the geometric errors produced in these regions. However, we believe that theproposed algorithm could find a wider use, for example in image reconstruction. Our method can be viewed as an extensionof the GENO method which was shown to provide excellent results in [8]. However, when sample points are placed lessdensely the GENO interpolant may become noticeably less smooth. In this case, the smoother Euler spiral approximationmay be more advantageous.

In this work, we did not consider a situationwhere a sharp corner of the solution is located between sample points as thisdoes not occur in applications we are interested in. Placing a shock inside of an element should be possible in the spirit ofthe subpixel interpolation described in [8]. However, the step function example demonstrates that the spiral interpolationcan handle this situation very well even without the shock placement.

Acknowledgment

This research was supported in part by Natural Sciences and Engineering Research Council (NSERC) of Canada, grants341373-07 and 344630-06.

References

[1] K.G. Baass, The use of Clothoid templates in highway design, Transp. Forum 1 (1984).[2] Zhiyang Yao, Ajay Joneja, Path generation for high speed machining using spiral curves, Comput. Aided Des. Appl. 4 (2007) 191–198.[3] B. Kimia, I. Frankel, A.-M. Popescu, Euler spiral for shape completion, Int. J. Comput. Vis. 54 (2003) 159–182.[4] L. Krivodonova, M. Berger, High-order accurate implementation of solid wall boundary conditions in curved geometries, J. Comput. Phys. 211 (2006)

492–512.

Page 13: Interpolation of two-dimensional curves with Euler spirals

332 D. Connor, L. Krivodonova / Journal of Computational and Applied Mathematics 261 (2014) 320–332

[5] K.J. Fidkowski, D.L. Darmofal, A triangular cut-cell adaptive method for high-order discretizations of the compressible Navier–Stokes equations,J. Comput. Phys. 225 (2007) 1653–1672.

[6] R. Sevilla, S. Fernandez-Mendez, A. Huerta, NURBS-enhanced finite element method for Euler equation, Int. J. Numer. Methods Fluids 87 (2007) 1–28.[7] R. Sevilla, S. Fernandez-Mendez, Numerical integration over 2DNURBS-shaped domainswith applications to NURBS-enhanced FEM, Finite Elem. Anal.

Des. 47 (2011) 1209–1220.[8] K. Siddiqi, B. Kimia, C.-W. Shu, Geometric shock-capturing ENO schemes for subpixel interpolation, computation and curve evolution, Graph. Models

Image Process. 59 (1997) 278–301.[9] A. Harten, B. Engquist, S. Osher, S. Chakravarthy, Uniformly high-order accurate essentially nonoscillatory schemes III, J. Comput. Phys. 71 (1987)

231–303.[10] D.J. Walton, D.S. Meek, An improved Euler spiral algorithm for shape completion, in: CRV ’08: Proceedings of the 2008 Canadian Conference on

Computer and Robot Vision, IEEE Computer Society, Washington, DC, USA, 2008, pp. 237–244.[11] D.S. Meek, D.J. Walton, A note on finding clothoids, J. Comput. Appl. Math. 170 (2004) 433–453.[12] J. Stoer, Curve fitting with clothoidal splines, J. Res. Natl. Bur. Stand. 87 (1982) 317–346.[13] C. de Boor, A Practical Guide to Splines, Springer, 2001.[14] D.J. Walton, D.S. Meek, G1 interpolation with a single Cornu spiral segment, J. Comput. Appl. Math. 223 (1) (2009) 86–96.[15] M. Abramowitz, I.A. Stegun (Eds.), Handbook of Mathematical Functions, Dover, New York, 1965.[16] W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery, Numberical Recipes, third ed., Cambridge, 2007.[17] M. Heald, Rational approximations for the Fresnel integrals, Math. Comp. 170 (1985) 459–461.[18] C. Moler, Numerical Computing with MATLAB, Society for Industrial and Applied Mathematics, 2004.[19] M.J. Aftosmis, M.J. Berger, J.E. Melton, Adaptive Cartesian Mesh Generation, 1999.


Recommended