Bi Arc Curve Fitting 2

5
Biarc Curve Fitting Hakan Tiftikci [email protected] August 2009 1 Introduction Biarc curve fitting determines two circular arcs passing through two given points and tangents at those points. When applied to a series of points, it determines a piecewise circular arc interpolation of given points. This document summarizes the work of [ROSSIGNAC,REQUICHA] 2 Formulation of Jaroslaw & Aristides Following figure depicts a biarc curve fitting through points P 1 , P 2 with given tangents T 1 , T 2 . T 1 T 2 C 1 C 2 a 1 a 1 a 2 a 2 r 1 r 2 P 1 P 2 B 1 B 2 B 12 X 1 Y 1 X 2 Y 2 θ 1 θ 1 θ 2 θ 2 apex points of two segments are given by 1

Transcript of Bi Arc Curve Fitting 2

Page 1: Bi Arc Curve Fitting 2

Biarc Curve Fitting

Hakan Tiftikci

[email protected]

August 2009

1 Introduction

Biarc curve fitting determines two circular arcs passing through two given points and tangentsat those points. When applied to a series of points, it determines a piecewise circular arcinterpolation of given points.

This document summarizes the work of [ROSSIGNAC,REQUICHA]

2 Formulation of Jaroslaw & Aristides

Following figure depicts a biarc curve fitting through points P1,P2 with given tangents T1,T2.

T1

T2

C1

C2

a 1

a1

a2

a2

r1

r2

P1

P2B1

B2

B12

X1

Y1

X2

Y2

θ1

θ1

θ2θ2

apex points of two segments are given by

1

Page 2: Bi Arc Curve Fitting 2

B1 = P1 + a1T1

B2 = P2 − a2T2

relations that those points must satisfy are

|B1 −P1| = |B12 −B1| = a1 (1)

|B2 −P2| = |B12 −B2| = a2 (2)

|B2 −B1| = a1 + a2 (3)

where junction points of two arcs is

B12 = B1 +a1

a1 + a2

(B2 −B1) =a2B1 + a1B2

a1 + a2

Substituting definitions of B1,B2 in basic equation

B2 −B1 = (P2 − a2T2)− (P1 + a1T1)

= P2 −P1 − (a1T1 + a2T2)

and definingP2 −P1 ≡ S

basic equation becomes

|B2 −B1|2 = (a1 + a2)2

(P2 −P1 − (a1T1 + a2T2))2 = (a1 + a2)

2

(S− (a1T1 + a2T2))2 = (a1 + a2)

2

S2 − 2S · (a1T1 + a2T2) + (a1T1 + a2T2)2 = (a1 + a2)

2

S2 − 2S · (a1T1 + a2T2) + a21T

21 + 2a1a2T1 ·T2 + a2

2T22 = a2

1 + 2a1a2 + a22

S2 − 2S · a1T1 − 2S · a2T2 + a21 + 2a1a2T1 ·T2 + a2

2 = a21 + 2a1a2 + a2

2

S2 − 2S · a1T1 − 2S · a2T2 + 2a1a2T1 ·T2 = 2a1a2

a1a2 (T1 ·T2 − 1) +S2

2= a1S ·T1 + a2S ·T2

General formula is given (in [ROSSIGNAC,REQUICHA, p. 300])

a2 =a1 (S ·T1)− 1

2‖S‖2

a1 (T1 ·T2 − 1)− S ·T2

2.0.1 Specified ratio of ai

If the ratio of two side lengths is specified

ρ =a2

a1

then

a1ρa1 (T1 ·T2 − 1) +S2

2= a1S ·T1 + ρa1S ·T2

a21 [ρ (T1 ·T2 − 1)]− a1 (S ·T1 + ρS ·T2) +

S2

2= 0

this general relation has some special cases that must be handled. These cases are described in[ROSSIGNAC,REQUICHA]

2

Page 3: Bi Arc Curve Fitting 2

2.1 Other Relations Between Auxiliary Points

When junction point expressed in initial variables

B12 =a2B1 + a1B2

a1 + a2

=a2 (P1 + a1T1) + a1 (P2 − a2T2)

a1 + a2

=a2P1 + a2a1T1 + a1P2 − a1a2T2

a1 + a2

=a2P1 + a1P2 + a2a1 (T1 −T2)

a1 + a2

chords of arcs become

B12 −P1 =a2P1 + a1P2 + a2a1 (T1 −T2)

a1 + a2

−P1

=a2P1 + a1P2 + a2a1 (T1 −T2)− (a1 + a2) P1

a1 + a2

=a1 (P2 −P1) + a2a1 (T1 −T2)

a1 + a2

B12 −P2 =a2P1 + a1P2 + a2a1 (T1 −T2)

a1 + a2

−P2

=a2P1 + a1P2 + a2a1 (T1 −T2)− (a1 + a2) P2

a1 + a2

=a2 (P1 −P2) + a2a1 (T1 −T2)

a1 + a2

2.2 Computing arc center and angle

This section describes the computation of center and arc-angle of two arcs from given two pointson circle (A,C) and apex point B. Consider following figure

A

B

C

O

Rco

s(θ)

θθ

3

Page 4: Bi Arc Curve Fitting 2

If points A,C are on circle and tangents to circle at A,C intersect at apex B, then

−→AB ·

−−→BC = cos (2θ) = D

−→AB ×

−−→BC = sin (2θ) a

(where a is arc-plane normal).From

cos (2θ) = 2 cos2 θ − 1

= 1− 2 sin2 θ

cos θ =

√1 +D

2

sin θ =

√1−D

2

tan θ =sin θ

cos θ=

√1−D1 +D

from

tan θ =AB

r

radius is determined as

r =AB

tan θ=

√1 +D

1−DAB

fromcos θ =

r

BO

circle center-to-apex distance BO is computed as

BO =r

cos θ

then center of arc is

O = B +r

cos θ

−→BA+

−−→BC∣∣∣−→BA+−−→BC∣∣∣

2.2.1 Using complex numbers

Center can be found from the intersection of line segments through point a and c with directionsi (b− a) , i (c− b) that is

a+ λi (b− a) = c+ µi (c− b)

Placing P1, P2 on real axis with midpoint P1+P2

2in origin, start and points become

p1 = −s2

+ 0i

p2 = +s

2+ 0i

junction points is

b12 =a2−s2

+ a1s2

+ a2a1

(eiθ1 − eiθ2

)a1 + a2

4

Page 5: Bi Arc Curve Fitting 2

and apex points are

b1 = −s2

+ a1eiθ1

b2 = +s

2− a2e

iθ2

For the first control triangle

(− s

2,− s

2+ a1e

iθ1 ,a2−s2

+a1s2+a2a1(eiθ1−eiθ2)a1+a2

)intersection is described

by

−s2

+ λieiθ1 = +s

2+ µieiθ2

λieiθ1 − µieiθ2 = s

λeiθ1 − µeiθ2 = −is

λ cos θ1 − µ cos θ2 = 0

λ sin θ1 − µ sin θ2 = −s

λ cos θ1 sin θ1 − µ cos θ2 sin θ1 = 0

λ sin θ1 cos θ1 − µ sin θ2 cos θ1 = −s cos θ1

−µ (cos θ2 sin θ1 − sin θ2 cos θ1) = s cos θ1

µ =s cos θ1

cos θ2 sin θ1 − sin θ2 cos θ1

=cos θ1

cos (θ1 + θ2)s

References

[ROSSIGNAC,REQUICHA] ”Piecewise circular curves for geometric modeling”, Jaroslaw R.Rossignac, Aristides A.G. Requicha, IBM J. RES. DEVELOP.VOL.3, NO.3 May 1987

5