Sie sind auf Seite 1von 18

28

CHAPTER 4
THEORETICAL DEVELOPMENT
4.1 Analytical Solution
A solution to the problem oI generating oIIset curves to a cubic Bzier curve was
initially attempted by representing the oIIset curves by equations similar to that a Bzier
curve. The conceptual idea was that an oIIset curve represented using a simple cubic
equation can be rendered using the existing techniques |see section 2.5|.
An initial attempt Ior an analytical solution was attempted by Dr. Thomas F. Hain
and Elena Galaktionova at University oI South Alabama |7|. This attempt was
unsuccessIul. Also, |3| indicates that the oIIset curves to a Bzier curve cannot be
represented in the Iorm oI a cubic equation as in the case oI the Bzier path curve.
4.2 Circular Approximation
Circular Approximation Algorithm (CAA) is name oI the proposed technique oI
approximating the oIIset curves to a cubic Bzier curve. This technique approximates the
oIIset curves using polylines so that the desired Ilatness criterion is adequately met on
both the oIIset curves.

29
4.2.1 Conceptual Discussion
This section discusses the concept oI CAA. Let Q be a Bzier curve and let Q
+

and Q

denote the leIt and right oIIset curves at a distance d to the Bzier curve Q. CAA
processes the Bzier curve Q twice. The Iirst pass generates the polyline approximating
the leIt curve Q
+
and the second pass generates the polyline approximating the right
curve Q

. The polylines approximating the oIIset curves are generated such that the
achieved Ilatness Ior each segment (other than the last) is close to the desired Ilatness.

30
4.2.1.1 Left Offset Curve


Figure 13 Left Offset Curve



Figure 13 shows a Bzier curve Q, and a circle tangential to Q and having the
same curvature, and the leIt oIIset curve. Consider point
0
0 on the path oI a thick Bzier
curve Q using an xy-coordinate system in which the x-axis is tangential to the path
deIined by control points
0
0 ,
1
0 ,
2
0 , and
8
0 . Let t be the parametric variable, ranging
Irom 0 (at
0
0 ) to 1 (at
8
0 ). Over suIIiciently small distances Irom
0
0 (i.e., small values
oI t), the path as well as its oIIset curves may be approximated by concentric arcs
I

P
0
P
2
P
3
P
1
x
y
Q

B'
G/2

O

A

B

C

A'


31
centered at O, as shown. The radius oI curvature oI the path is denoted as R. Now
consider point ' " on the path having a parametric value t, and at coordinate ( ), ( ) X T Y T .
The coordinates may be calculated Irom the control points as Iollows:


2 8
0 0 0 0 1 2 1 8 2 1
2 8
0 0 0 0 1 2 1 8 2 1
( ) 8 8 2 8 8
( ) 8 8 2 8 8
X X X X X X X X X X
Y Y Y Y Y Y Y Y Y Y
X T 0 0 0 T 0 0 0 T 0 0 0 0 T
Y T 0 0 0 T 0 0 0 T 0 0 0 0 T



Since
0
0 is at the origin, and the x-axis is tangential to the path, we have
that
0 0 1
0
X Y Y
0 0 0 . Thus,


2 8
1 2 1 8 2 1
2 8
2 8 2
( ) 8 8 2 8 8
( ) 8 8
X X X X X X
Y Y Y
X T 0 T 0 0 T 0 0 0 T
Y T 0 T 0 0 T



II we Iurther assume a small value oI t, the higher terms are dominant, and
1
2
2
( ) 8
( ) 8
X
Y
X T 0 T
Y T 0 T
x
x

From this, iI we are trying to achieve a Ilatness criterion I on the path curve, we
can calculate the value oI t where the curve deviates Irom its chord as Iollows:
2
1
2
2
2
( ) 8 ( )
i.o., 2
8
Y
Y
Y T F 0 T
F
T
0
a

a


The maximum deviation Irom the inner oIIset curve can be related to the
maximum deviation oI the path curve by noting the triangles /!" + and /! " a a + are
similar, and likewise !"# + and
0
! " 0
a a
+ . It can easily be seen that

32
0
2
1
' ' 2
D
2
F !# !" /" D
F ! " 2 2
! 0 /"


a
a a

where d is the thickness oI the Bzier curve. All that remains to be known is the radius oI
curvature, R. For small t, we may assert that
1
( ) 8
X
! " X T 0 T
a a
x x . From Pythagorean
theorem we have

2
2 2
2
2 2 2
1
2
( ) ( )
8
( ) ( ) ( )
i.o.,
2 ( ) 2 ( ) 2
X
Y
2 X T 2 Y T
0
Y T X T X T
2
Y T Y T 0

x x

The 'eIIective Ilatness required Ior the path to ensure the required Ilatness f Ior
the inner oIIset curve is thus
2
2
1
'
1
8
Y
X
F
F
D0
0


The required t is calculated Irom

2
2
8
Y
F
T
0
a
,
deIining a point on the path curve. The corresponding point on the inner oIIset curve
(i.e., polygon point) is calculated at a perpendicular distance oI a/2. ReIer to Figure 5.

33
4.2.1.2 Right Offset Curve


Figure 14 Right Offset Curve



Figure 14 shows a Bzier curve Q, and a circle tangential to Q and having the
same curvature, and the right oIIset curve. Consider point
0
0 on the path oI a thick Bzier
curve Q using an xy-coordinate system in which the x-axis is tangential to the path
O

I

P
2
P
1
Q

B'

G/2
A

B

C

A'

x
P
0
P
3
y

34
deIined by control points
0
0 ,
1
0 ,
2
0 , and
8
0 . Let t be the parametric variable, ranging
Irom 0 at
0
0 to 1 at
8
0 . Over suIIiciently small distances Irom
0
0 (small values oI t), the
path as well as its oIIset curves may be approximated by concentric arcs centered at O, as
shown in Figure 14. The radius oI curvature oI the path is denoted as R. Now consider
point ' " on the path having a parametric value t, and at coordinate ( ), ( ) X T Y T . The
coordinates may be calculated Irom the control points as Iollows:


2 8
0 0 0 0 1 2 1 8 2 1
2 8
0 0 0 0 1 2 1 8 2 1
( ) 8 8 2 8 8
( ) 8 8 2 8 8
X X X X X X X X X X
Y Y Y Y Y Y Y Y Y Y
X T 0 0 0 T 0 0 0 T 0 0 0 0 T
Y T 0 0 0 T 0 0 0 T 0 0 0 0 T



Since
0
0 is at the origin, and the x-axis is tangential to the path, we have
that
0 0 1
0
X Y Y
0 0 0 . Thus,


2 8
1 2 1 8 2 1
2 8
2 8 2
( ) 8 8 2 8 8
( ) 8 8
X X X X X X
Y Y Y
X T 0 T 0 0 T 0 0 0 T
Y T 0 T 0 0 T



II we Iurther assume a small value oI t, the higher terms are dominant, and
1
2
1
( ) 3
( ) 3
x
y
x t P t
y t P t
~
~

From this, iI we are trying to achieve a Ilatness criterion I on the path curve, we
can calculate the value oI t where the curve deviates Irom its chord as Iollows:
2
1
2
2
2
( ) 8 ( )
i.o., 2
8
Y
Y
Y T F 0 T
F
T
0
a

a



35
The maximum deviation Irom the outer oIIset curve can be related to the
maximum deviation oI the path curve by noting the triangles /!" + and /! " a a + are
similar, and likewise !"# + and
0
! " 0
a a
+ . It can easily be seen that
0
2
1
' ' 2
D
2
F !# !" /" D
F ! " 2 2
! 0 /"


a
a a

where d is the thickness oI the Bzier curve. All that remains to be known is the
radius oI curvature, R. For small t, we may assert that
1
( ) 8
X
! " X T 0 T
a a
x x . From
Pythagoras` law we have

2
2 2
2
2 2 2
1
2
( ) ( )
8
( ) ( ) ( )
i.o.,
2 ( ) 2 ( ) 2
X
Y
2 X T 2 Y T
0
Y T X T X T
2
Y T Y T 0

x x

The 'eIIective Ilatness required Ior the path to ensure the required Ilatness f Ior
the outer oIIset curve is thus
2
2
1
'
1
8
Y
X
F
F
D0
0


The required t is calculated Irom

2
2
8
Y
F
T
0
a
,
deIining a point on the path curve. The corresponding point on the outer oIIset
curve (i.e., polygon point) is calculated at a perpendicular distance oI a/2. ReIer to Figure
5.

36
4.2.2 Inflection Points
InIlection points are the points on the curve where the tangent to the curve
changes direction. During testing with the visual testing tool (explained in Section 3.5) it
was observed that the circular approximation technique Iails at and very close to the
inIlection points. We know that a Bzier curve may have zero to two inIlection points. So
there is a need to handle the approximation oI curves with inIlection points in a diIIerent
way. This has been done by identiIying the inIlection points and then excising the curve
segment around the inIlection point and approximating the excised curve segment with a
line segment. The Iollowing paragraphs describe the method to excise Bzier curves with
inIlection points.
We can write the parametric Iunctions as
3 2
3 2
( )
( )
x x x x
y y y y
x t a t b t c t a
y t a t b t c t a

= + + +

= + + +


where, using the Bzier basis matrix, the coeIIicients in terms oI the control
points are

1 2 3 4 1 2 3 4
1 2 3 1 2 3
1 2 1 2
1 1
3 3 3 3
3 6 3 3 6 3
3 3 3 3
x y
x y
x y
x y
a x x x x a y y y y
b x x x b y y y
c x x c y y
a x a y
= + + = + +
= + = +
= + = +
= =

At inIlection points the component oI the acceleration (second derivative oI
position) perpendicular to the velocity (Iirst derivative oI position) is zero; the cross
product oI the two vectors is zero. Thus,

37
2 2
2 2
2 2
2
(3 2 )(6 2 ) (6 2 )(3 2 )
6( ) 6( ) 2( ) 0
x x x y y x x y y y
y x x y y x x y y x x y
ax a y a x ay
at at at at
a t b t c a t b a t b a t b t c
a b a b t a c a c t b c b c

= + + + + + +
= + + =

Solving this quadratic equation Ior t yields
2
1
2
2
1
2
1
3
1
3
y x x y
cusp
y x x y
y x x y
cusp cusp
y x x y
y x x y
cusp cusp
y x x y
a c a c
t
a b a b
b c b c
t t t
a b a b
b c b c
t t t
a b a b
| |
= |
|

\ .
| |
= |
|

\ .
| |
= + |
|

\ .

the parametric positions
1
t and
2
t oI the inIlection points, iI they exist (i.e., have
real solutions).
4.2.2.1 Processing Inflection Points
The parametric equation oI the curve ( ) ( ) ( ), ( ) Q t x t y t = is
3 2 2 3
1 2 3 4
3 2 2 3
1 2 3 4
( ) (1 ) 3 (1 ) 3 (1 )
( ) (1 ) 3 (1 ) 3 (1 )
x t t x t t x t t x t x
y t t y t t y t t y t y

= + + +

= + + +


We now express the equations in terms oI coordinates r and s, with the origin
being at
1
P , the start oI the curve at 0 t = , the r-axis being oriented along the velocity
vector oI the curve at 0 t = (i.e., toward
2
P ), and the s-axis being right-handed
orthogonal to the r-axis. That is,
( ) ( ) ( ) ( )
2 1 2 1 2 1
2 2 2 2
2 1
2 1 2 1 2 1 2 1
` ,
x x y y
x x y y x x y y
| |

|
= =
|

+ +
\ .
P P
r
P P


38
( ) ( )
( )
( ) ( )
2 1
2 1
2 2 2 2
2 1 2 1 2 1 2 1
` ,
x x
y y
x x y y x x y y
| |

|
=
|
+ +
\ .
s
Thus, a point ( , ) x y P has coordinates

( )
( ) ( ) ( )( ) ( )
( ) ( )
1
1 2 1 1 2 1
2 2
2 1 2 1
` r
x x x x y y y y
x x y y
=
+
=
+
P P r

and

( )( ) ( )( ) ( )
( ) ( )
1 2 1 1 2 1
2 2
2 1 2 1
x x y y y y x x
s
x x y y

=
+

In this coordinate system, the control points are ( ) ( )
1 1 1 4 4 4
, , , , r s r s P P , and
considering only the movement oI the curve in the s-direction
3 2 2 3
1 2 3 4
( ) (1 ) 3 (1 ) 3 (1 ) s t t s t t s t t s t s = + + + (0.1)
At inIlection points only the derivative oI the acceleration has a component
perpendicular to the velocity vector. Thus, iI we subdivide the curve at an inIlection
point, say
1
t , and consider the second segment, again using an r-s coordinate system with
the r-axis aligned with the velocity at the inIlection point and the origin at the inIlection
point, we have
1 1 2 3
0 r s s s = = = = , and equation (0.1) becomes
( )
3
4
( ) s t t s ' ' =
where t' is the parametric value relative to this segment (in which |0,1| t' e ).
II we set ( ) s t f ' = and solve Ior t' , we have

39
3
4
f
f
t
s
=
The achieved Ilatness oI the curve segments | , 0|
f
t and |0, |
f
t will be less than
the
2
transverse displacement ( )
f
s t . Since the maximum transverse displacement Ior
these two segments are oI opposite sign, we can merge these segments into a single
segment having the parametric range | , |
f f
t t + and Ilatten it. TransIorming this
parametric range into the corresponding parametric range in the original curve yields
1 1
| , | t t
+
where
1 1 1
(1 )
f
t t t t

= and
1 1 1
(1 )
f
t t t t
+
= + . A similar parametric range
2 2
| , | t t
+
is Iound surrounding the second (existing) inIlection point
2
t .
4.2.2.2 Handling Segments around Inflection Points
Several cases must be handled, and these are summarized in Table 1

Table 1 Case Analysis for Inflection Segments
Case Treatment
1 1
2 2
| , | |0,1|
| , | |0,1|
t t
t t
+
+
_
. = C

Use parametric approximation to Ilatten segment
1
|0, | t

.
Replace curve segment
1 1
| , | t t
+
by line segment. Use
parametric approximation to Ilatten segment
1
| , 1| t
+
.
1 1
2 2
0 | , |
| , | |0,1|
t t
t t
+
+
e
. = C

Replace curve segment
1
|0, | t
+
by line segment. Use parametric
approximation to Ilatten segment
1
| ,1| t
+
.
1 1 2 2
1 2
| , | | , |
| , | |0,1|
t t t t
t t
+ +
+
= C
. _

Use parametric approximation to Ilatten segment
1
|0, | t

.
Replace curve segments
1
| , |
cusp
t t

and
1
| , |
cusp
t t
+
by line
segments. Use parametric approximation to Ilatten segment
2
| , 1| t
+
.
Other cases Handled similarly.

2
In parabolic approximation it was smaller by a Iactor oI 4, but here we make no such assertion, and use
the conservative value.

40
4.2.3 Algorithm Description
In CAA, we process the path curve twice to obtain the leIt and right polylines.
Each pass starts at the Iirst control point and removes the path curve segments Ior which
the oIIset curve meets the Ilatness criterion. This process continues until the Iourth
control point is reached.
Let a cubic Bzier curve segment ( ) Q t be deIined by its control points
1 4
P

. Let
us assume that we have to derive the leIt oIIset curve Iirst. The Iirst step is to compute
and store the leIt oIIset point corresponding to the Iirst control point
1
P , in the polyline
point sequence. Next we compute the maximum circular approximation excursion (t)
using the Iormulas
2
2
1
'
1
3
y
x
f
f
aP
P
=

and
2
2
8
Y
F
T
0
a
in a normalized coordinate system
(reIer Appendix D). II 1 t > then we stop aIter storing the leIt oIIset point corresponding
to the Iourth control point
4
P , in the polyline point list. II 0 t < then we have an invalid
value oI t and we stop circular approximation. This is case where circular approximation
Iails. It happens because the radius oI the circle approximating the leIt oIIset curve is
negative. We determine that circular approximation is successIul iI such a Iailing
condition does not occur. II | ) 0,1 t e , we compute and store the leIt oIIset point
corresponding to path curve point at parametric value oI t. Then, we divide the path
curve at parametric value oI t. into two segments. The achieved Ilatness Ior the Iirst
segment oI leIt oIIset curve should be equal to the desired Ilatness f. Since, this is an
approximation the calculated value may not be exactly equal. Then, we repeat the

41
process on the second Bzier segment. This process is continued until the leIt oIIset
curve oI second Bzier path segment satisIies the required Ilatness.
The process oI Iinding the right oIIset curve is similar. The diIIerence is only that
the Iormulas used to compute the maximum circular approximation excursion
are
2
2
1
'
1
8
Y
X
F
F
D0
0

and
2
2
8
Y
F
T
0
a
.

42

Figure 15 Flowchart of Circular Approximation Algorithm - Left Offset Curve



As explained beIore CAA cannot be applied directly when the path curve has
inIlection points. Such a case will have to be dealt with by excising the curve. First, we
Iind the parametric values oI two inIlection points (ip
1
and ip
2
). Then the line segments
CAA - Left offset curve
Compute and store leIt oIIset point Ior
1
st
control point
Stop
While
2
2
1
'
1
8
Y
X
F
F
D0
0


2
2
8
Y
F
T
0
a

Compute and
store leIt oIIset
point Ior 4
th

control point
Clear the leIt
polyline list
Compute and store leIt
oIIset point Ior path
curve point ( ) Q t
Subdivide Q into
1
Q
S and
2
Q
S
0 t <
1 t >
| ) 0,1 t e
Repeat
Ior
2
Q
S
CAA Fails
CAA
Success
t

43
that approximate the curve at the two inIlections points (ip
1
minus, ip
1
plus and ip
2
minus,
ip
2
plus Ior ip
1
and ip
2
respectively) are computed. The line segment obtained by Iinding
the points at Q(ip
1
minus) and Q(ip
1
plus) satisIies the Ilatness criterion. Similarly the line
segment obtained by Iinding the points at Q(ip
2
minus) and Q(ip
2
plus) also satisIies the
Ilatness criterion. Finally the parametric values are used to subdivide the curve
appropriately and call the CAA as outlined in Figure 16.

44

Start(Q)
find inflection points, ip1, ip2, cusp of Q
if no inflection points
{
do CAA for Q
stop
}
else
{
find ip1minus, ip1plus
find ip2minus, ip2plus
if (0 < ip1minus)
{
if (1 <= ip1minus)
do CAA for Q
else // (ip1minus < 1)
{
subdivide Q into Q1 and Q2 at ip1minus
do CAA for Q2
add offset points at Q(ip1minus) to polylines
if (ip2minus < ip1plus) // cusp
{
if (cusp < 1)
add offset points at Q(cusp) to polylines
if (ip2plus < 1)
{
subdivide Q into Q1 and Q2 at ip2plus
do CAA for Q2
}
}
else if (ip1plus < 1)
{
if (ip2minus < 1)
{
subdivide Q into Q1, Q2 and Q3 at ip1plus and ip2minus
do CAA for Q2
add offset points at Q(ip2minus) to polylines
if (ip2plus < 1)
{
subdivide Q into Q1 and Q2 at ip2plus
do CAA for Q2
}
}
else //(ip2minus >= 1)
{
subdivide Q into Q1 and Q2 at ip1plus
do CAA for Q2
}
}
}
}
else if (0 < ip1plus)
{
add offset points at Q(0) to polylines
if (ip2minus < ip1plus) // cusp
{
if (cusp < 1)
add offset points at Q(cusp) to polylines
if (ip2plus < 1)
{
subdivide Q into Q1 and Q2 at ip2plus
do CAA for Q2
}
}
else if (ip1plus < 1)
{
if (ip2minus < 1)

45
{
subdivide Q into Q1, Q2 and Q3 at ip1plus and ip2minus
do CAA for Q2
add offset points at Q(ip2minus) to polylines
if (ip2plus < 1)
{
subdivide Q into Q1 and Q2 at ip2plus
do CAA for Q2
}
}
else //(ip2minus >= 1)
{
subdivide Q into Q1 and Q2 at ip1plus
do CAA for Q2
}
}
}
else if (0 < ip2minus)
{
if (ip2minus < 1)
{
subdivide Q into Q1 and Q2 at ip2minus
do CAA for Q1
add offset points at Q(ip2minus) to polylines
if (ip2plus < 1)
{
subdivide Q into Q1 and Q2 at ip2plus
do CAA for Q2
}
}
else //(ip2minus >= 1)
do CAA for Q
}
else if (0 < ip2plus)
{
add offset point at Q(0) to polylines
if (ip2plus < 1)
{
subdivide Q into Q1 and Q2 at ip2plus
do CAA for Q2
}
}
else
do CAA for Q
add offset points at Q(1) to polylines
}
stop
Figure 16 Algorithm for handling cases with inflection points

Das könnte Ihnen auch gefallen