Self-intersections of rational Bézier curves

Self-intersections of rational Bézier curves

Graphical Models xxx (2014) xxx–xxx Contents lists available at ScienceDirect Graphical Models journal homepage: www.elsevier.com/locate/gmod Self-...

1MB Sizes 4 Downloads 116 Views

Graphical Models xxx (2014) xxx–xxx

Contents lists available at ScienceDirect

Graphical Models journal homepage: www.elsevier.com/locate/gmod

Self-intersections of rational Bézier curves Chun-Gang Zhu ⇑, Xuan-Yi Zhao School of Mathematical Sciences, Dalian University of Technology, Dalian 116024, China

a r t i c l e

i n f o

Article history: Received 2 March 2014 Received in revised form 1 April 2014 Accepted 2 April 2014 Available online xxxx Keywords: Rational Bézier curve Self-intersection Injectivity Control polygon

a b s t r a c t Rational Bézier curves provide a curve fitting tool and are widely used in Computer Aided Geometric Design, Computer Aided Design and Geometric Modeling. The injectivity (one-to-one property) of rational Bézier curve as a mapping function is equivalent to the curve without self-intersections. We present a geometric condition on the control polygon which is equivalent to the injectivity of rational Bézier curve with this control polygon for all possible choices of weights. The proof is based on the degree elevation and toric degeneration of rational Bézier curve. Ó 2014 Elsevier Inc. All rights reserved.

1. Introduction The rational Bézier curves/patches are widely used in Computer Aided Geometric Design (CAGD), Computer Aided Design (CAD) and Geometric Modeling as the curve/surface fitting tool because of their precisely representation of the conics and preservation of good properties. The shape of rational Bézier curve can be adjusted by its control polygon and weights. The basic properties and algorithms for the rational Bézier curve are illustrated in Farin’s book [1] and paper [2]. As is well-known, the self-intersection of rational Bézier curve leads to bad influence in the offsets design of the curve [3,4]. In [5], Hoffmann mentioned that the intersection problem has become a fundamental problem in solid modeling systems and the integration of geometric objects. As a mapping function, the injectivity (one-to-one property) of rational Bézier curve is equivalent to the curve without self-intersections. In 1989, Lasser [3] proposed a curve-curve algorithm to calculate the self-intersection of Bézier curve by subdividing the control polygon of the curve using the de Casteljau ⇑ Corresponding author. E-mail addresses: [email protected] (C.-G. Zhu), zhaoxy2012@mail. dlut.edu.cn (X.-Y. Zhao).

algorithm. This method needs to check the possibility of the curve with the self-intersection by the sum of the rotation angles of control polygon before the algorithm begins. Tiller and Hanson [4] presented an algorithm to calculate the self-intersections of B-spline curve. Unfortunately, their methods may fail to the Bézier curve because the Bézier curve may have no self-intersection though the sum of the rotation angles is bigger than p. On the other hand, the Bézier curve may have self-intersections though its control polygon without self-intersections actually. For the 2D and 3D surface patches, many papers studied on the conditions which imply the injectivity of the patches. In 1996, Goodman and Unsworth [6] proposed a sufficient condition for the injectivity of a 2D Bézier function. For the control points of a m  n tensor product patch, their condition involves 2mðm þ 1Þ þ 2nðn þ 1Þ linear inequalities. For image morphing, Choi and Lee [7] presented a sufficient condition for the injectivity of 2D and 3D uniform cubic B-spline functions. Their condition provides a single bound for the displacements of control points that guarantees the injectivity of the cubic B-spline function. Fig. 1 shows three rational planar cubic Bézier curves with their control polygons. According to the Lasser’s method [3], the curve in Fig. 1(a) may have self-intersections. On the contrary, we claim that the curve has no self-intersection with any positive weights in accordance

http://dx.doi.org/10.1016/j.gmod.2014.04.001 1524-0703/Ó 2014 Elsevier Inc. All rights reserved.

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

2

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

(a)

(b)

(c)

Fig. 1. Three cubic rational Bézier curves.

with Theorem 3. The curve in Fig. 1(b) has one point of self-intersection, which may be removed by varying the weights as shown in Fig. 1(c). Geometrically, there is no self-intersection of the control polygon of the first curve while the others have. And we can learn from the variation diminishing property of rational Bézier curve that the shape of control polygon implies the shape of curve. This brings us a question: Does no self-intersection of control polygon of rational Bézier curve imply no self-intersection of the curve? The answer is NO. For example, the curve in Fig. 10(b) has one point of self-intersection while there is no self-intersection of its control polygon. We will explain the reason in this paper. In 2008, Craciun et al. [8] gave a geometric condition on the control points which implies that the resulting toric Bézier patch has no self-intersection with any choice of positive weights. Unfortunately, there is a minor flaw in the result cause it only guarantees the injectivity in the interior of the patch. Sottile and Zhu corrected that flaw for 2D patches in [9]. Recently, Zhu et al. [10] presented a geometric condition on control polygons to study the injectivity of planar rational Bézier curve. The cited works provided conditions which imply no self-intersection. Our purpose of this paper is different and proves the stronger result. We give a geometric condition on control polygons which implies the injectivity of the spatial rational Bézier curve for arbitrary positive weights. This paper is organized as follows. In Section 2, we recall the definition of rational Bézier curve and geometric property of its toric degeneration. In Section 3, we give the necessary and sufficient condition for the injectivity of rational Bézier curve for arbitrary positive weights, and some representative examples are illustrated. 2. Rational Bézier curves and toric degeneration In this section, we recall the classical definition of rational Bézier curve and its equivalent definition derived from Krasauskas’ toric surface patches [11]. To define geometric condition on the control polygon properly, we also recall the basic theory of the toric degeneration of rational Bézier curve (geometric meaning of control curves) presented by García-Puente et al. [12]. 2.1. Rational Bézier curves There is a fair amount of literature studied on rational Bézier curves. We just cite a few: Farin [1] and Davis

[13]. They presented the properties and basic theory of rational Bézier curves. The following definition and degree elevation property, we refer to those books. Definition 1. For given points bi 2 R3 ; i ¼ 0; . . . ; n, the parametric curve

Pn xi bi Bni ðuÞ RðuÞ ¼ Pi¼0 ; n n i¼0 xi Bi ðuÞ

u 2 ½0; 1;

ð2:1Þ

is called a rational Bézier curve of degree n, where   n ui ð1  uÞni are the Bernstein basis of degree Bni ðuÞ ¼ i n; bi are called control points and xi are the weights. The control polygon of the curve is the union of segments b0 b1 ; . . . ; bn1 bn between consecutive control points. By the degree elevation property of the Bernstein basis, the degree elevation property of rational Bézier curve can be derived directly. The rational Bézier curve RðuÞ (2.1) of degree n can be represented as a curve of degree n þ 1

Pnþ1   nþ1 xi bi Bi ðuÞ RðuÞ ¼ Pi¼0 ; nþ1  nþ1 ðuÞ i¼0 xi Bi

u 2 ½0; 1;

ð2:2Þ

where

  i i xi1 þ 1  xi ; nþ1 nþ1     i i  xi1 bi1 þ 1  xi b i xi ; bi ¼ nþ1 nþ1

xi ¼

i ¼ 0; . . . ; n þ 1;

x1 ¼ xnþ1 ¼ 0; b1 ¼ bnþ1 ¼ 0: Let Pr be the control polygon of curve RðuÞ rasing degree r times. Then the control polygons converge to the curve RðuÞ while r ! 1 as Theorem 1.

lim Pr ¼ RðuÞ:

r!1

ð2:3Þ

2.2. Toric degeneration of rational Bézier curves In 2002, Krasauskas [11] presented a new method to construct the multi-sided surface patches, named toric patches. The mathematical theory of toric patches is based on toric variety from Algebraic Geometry and toric ideals from Combinatorics. The classical tensor-product and triangular Bézier patches are the special cases of toric

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

3

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

patches. If the parametric domain is one-dimensional, then the toric patch degenerates to the rational Bézier curve. Suppose A ¼ fa0 ; a1 ; . . . ; an g ¼ D \ Z is a set of finite integers, where a0 < a1 <    < an , and the interval D ¼ ½a0 ; an . Let

bai ;A ðxÞ ¼ cai h1 ðxÞh1 ðai Þ h2 ðxÞh2 ðai Þ ;

ai 2 A;

where cai are positive real numbers and h1 ðxÞ ¼ x  a0 ; h2 ðxÞ ¼ an  x. The functions bai ;A ðxÞ are called toric Bézier basis. It is easy to check that those functions are nonnegative and have no common zeros on D. Let R> be the collection of the positive real numbers. Following the Krasauskas’ toric patches [11], the toric Bézier curve can be defined as follows. Definition 2. Given a set of finite integers A  Z, control points B ¼ fbai jai 2 Ag  R3 and the weights x ¼ fxai jai 2 Ag  R> , the parametric curve

Pn

xai bai bai ;A ðxÞ ; x2D i¼1 xai bai ;A ðxÞ

i¼1 FA;x;B ðxÞ ¼ P n

ð2:4Þ

is called a toric Bézier curve and the union of segments ba0 ba1 ; . . . ; ban1 ban is called the control polygon of the curve. Remark 1. If we set D ¼ ½0; n, then A ¼ f0; 1; . . . ; ng and h1 ðxÞ ¼ x; h2 ðxÞ ¼ n  x. For any i 2 A, the toric Bézier basis is

bi;A :¼ ci xi ðn  xÞni :

  n nn , then bi;A ðxÞ is the classii n cal Bernstein basis Bi ðuÞ and the parametric domain is changed to ½0; 1. By Remark 1, a toric Bézier curve can be reparametrized as a rational Bézier curve. This means the definition of toric Bézier curve is equivalent to the definition of rational Bézier curve. For convenience of analysis, we will use curves defined in (2.4) to represent rational Bézier curve in this paper. For higher dimensions, the toric Bézier basis and toric patches can be defined in the same way. We use a lifting function k : A # R to lift the points of A into R2 . Let Pk be the convex hull of the lifted points, If we let x ¼ nu and ci ¼

Pk ¼ conv fðai ; kðai ÞÞjai 2 Ag  R2 : The upper edges of P k are those whose outward pointing normals have positive last coordinates. The union of the upper edges is the upper hull of Pk . If we project this upper hull back to R, it covers D and induces a regular domain decomposition T k of D. The decomposition of A is called regular decomposition S k of A if each subset of S k consists of the points of A whose lifts lie on a common face in the upper hull of a lifted polygon P k . Example 1. Let A ¼ f0; 1; 2; 3g and D ¼ ½0; 3. Suppose the lifting function k1 has the assignments f1; 2; 3; 1g at the points f0; 1; 2; 3g, then the regular domain decomposition of D is T k1 ¼ f½0; 2; ½2; 3g and the regular decomposition of A is S k1 ¼ ff0; 1; 2g; f2; 3gg (see Fig. 2(a)). If the lifting function k2 , it has the assignments f1; 1; 3; 1g at the points f0; 1; 2; 3g, then the regular domain decomposition of D is T k2 ¼ f½0; 2; ½2; 3g and the regular decomposition is

S k2 ¼ ff0; 2g; f2; 3gg (see Fig. 2(b)). These two lifting functions induce the same regular domain decomposition of D but different regular decompositions of A since the lifted point ð1; k2 ð1ÞÞ does not lie on the upper hull of P k2 . Suppose that we have a regular decomposition S k of A induced by a lifting function k. We can use the weights xjF ¼ fxai jai 2 F g and control points BjF ¼ fbai jai 2 F g indexed by elements of a subsect F of S k as weights and control points for constructing a rational Bézier curve by Definition 2, denote by FF ;xjF ;BjF , which parametric domain is the corresponding subset of regular domain decomposition T k of D. The union of those toric Bézier curves

FA;x;B ðS k Þ :¼

[

FF ;xjF ;BjF ;

F 2S k

is called the regular control curve of the rational Bézier curve FA;x;B ðxÞ induced by the regular decomposition S k . The regular control curve induced by a regular decomposition is naturally a C 0 spline curve. Example 2 can better explain the meaning of the construction of regular control curves. Example 2. Let A ¼ f0; 1; 2; 3g; D ¼ ½0; 3, and the weights x ¼ f1; 4; 4; 1g. Two cubic rational Bézier curves and their control points fb0 ; b1 ; b2 ; b3 g are shown in Fig. 1(a) and (b). Using the lifting function k1 in Example 1, we get the regular domain decomposition T k1 ¼ f½0; 2; ½2; 3g of D and the regular decomposition S k1 ¼ ff0; 1; 2g; f2; 3gg of A. For the subset f0; 1; 2g, we can construct a rational quadric Bézier curve by the control points fb0 ; b1 ; b2 g and weights f1; 4; 4g, and a linear Bézier curve by the control points fb2 ; b3 g and weights f4; 1g. Then the regular control curve is the union of those two curves. Fig. 3(a) and (b) shows the regular control curves of the cubic Bézier curves in Fig. 1(a) and (b) respectively. For the given weights x ¼ fxai 2 R> jai 2 Ag, we get a family of weights which depend upon the lifting function k and a parameter t,





xk ðtÞ :¼ tkðai Þ xai jai 2 A : We use these weights to define a rational Bézier curve with parameter t,

Pn

i¼0 FA;xk ðtÞ;B ðx; tÞ ¼ P n

t kðaÞ xai bai bai ;A ðxÞ

i¼0 t

kðaÞ

xai bai ;A ðxÞ

;

x 2 D:

García-Puente et al. [12] proved that the regular control curve induced by the lifting function k is exactly the possible limit of rational Bézier curve FA;xk ðtÞ;B ðx; tÞ when the control points B are fixed but the parameter t ! þ1. This property is called the toric degeneration of Bézier curve. Theorem 2 [12]. limt!þ1 FA;xk ðtÞ;B ðx; tÞ ¼ FA;x;B ðS k Þ. Example 3. The rational cubic Bézier curve with the weights x ¼ f1; 4; 4; 1g and control polygon show in Fig. 1. The regular decomposition S k ¼ ff0; 1; 2g; f2; 3gg of A ¼ f0; 1; 2; 3g is induced by the lifting function k1 defined in Example 1. We can define the rational cubic Bézier curve FA;xk ðtÞ;B ðx; tÞ with  parameter t by a family of weights xk ðtÞ ¼ t; 4t 2 ; 4t 3 ; t . By Theorem 2, the limit of

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

4

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

(a) Regular decomposition induced by λ 1 .

(b) Regular decomposition induced by λ 2 .

Fig. 2. Two different regular decompositions of A.

e Let the points from A but remaining the points a0 ; an in A. e Let P be the control polygon of e ¼ fba jai 2 Ag. points set B i e be the union of the line segFA;x;B ðxÞ and the polygon P e consecutively. We ments connected by the points in B define the well-posedness of the control polygon of a rational Bézier curve.

(a)

Definition 3. The control polygon P of a rational Bézier curve is called non-well-posed if it satisfies one of the following conditions:

(b)

Fig. 3. The regular control curves of cubic Bézier curves.



e such that P e (a) P has self-intersections or there exists P has self-intersections; e such that the intersection of some line (b) there exists P e and the interior of some trisegment L ¼ bai baj of P e k < ai g (or angle or tetrahedron in conv fbak 2 Bja e k > aj g) is not empty. conv fbak 2 Bja



xk ðtÞ ¼ t; 4t2 ; 4t3 ; t is the regular control curve shown in Fig. 3 while t ! þ1. Fig. 4 shows the curves with t ¼ 1; t ¼ 5; t ¼ 10 respectively. 3. Self-intersections of rational Bézier curves

Otherwise, The control polygon P is called well-posed.

In [10], a geometric condition on the control polygon to study the injectivity of planar rational Bézier curve is presented. In this paper, we prove a stronger result. We give a geometric condition on the control polygon whose definition is equivalent to the injectivity of every rational Bézier curve with this control polygon for all possible choices of positive weights. For a rational Bézier curve FA;x;B ðxÞ defined by A ¼ fa0 ; . . . ; an g  Z, the weights x, and the control points e  A satisfying B ¼ fbai jai 2 Ag  R3 , let the subset A e This means that A e is obtained by dropping some a0 ; an 2 A.

(a) t = 1.

Example 4. The control polygons in Fig. 5(a) and (b) are well-posed, while the others in Fig. 5 are non-well-posed. The polygon connected by the line segments b0 b2 ; b2 b3 ; b3 b4 in Fig. 5(c) has a self-intersection, and the control polygon in Fig. 5(c) has a self-intersection as well. In Fig. 5(d), the line segment b3 b4 goes through the tetrahedron formed by fb0 ; b1 ; b2 ; b3 g and the line segment b3 b4 lies in the tetrahedron formed by fb0 ; b1 ; b2 ; b3 g as Fig. 5(e) shown.

(b) t = 4.

(c) t = 10.

Fig. 4. The toric degeneration of rational cubic Bézier curve.

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

5

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

(a)

(b)

(c)

(d)

(e)

(f)

Fig. 5. The well-posed and non-well-posed control polygons.

Lemma 1. There exists a choice of the weights of a rational Bézier curve of degree n ðn ¼ 2; 3Þ, such that the curve goes through any point inside the triangle ðn ¼ 2Þ or tetrahedron ðn ¼ 3Þ formed by its control points. The proof of Lemma 1 is trivial. We can set the weights for the first and the last control points to be 1, then solve the equation to get the other weights, which satisfies the curve going through the point inside the triangle ðn ¼ 2Þ or tetrahedron ðn ¼ 3Þ formed by its control points. Theorem 3. Given a set of finite integers A  Z and control points B ¼ fbai jai 2 Ag  R3 , for any choice of the weights x ¼ fxai jai 2 Ag  R> , there is no self-intersection of rational Bézier curve FA;x;B ðxÞ if and only if the control polygon of the curve is well-posed.

Proof. We prove the necessity by contradiction. Suppose the control polygon P of FA;x;B ðxÞ is non-well-posed. If P satisfies the condition ðaÞ in Definition 3, then P has e such that P e has selfself-intersections or there exists P intersections. Note that P having self-intersections is the e We assume special case of the later one (that is P ¼ P). e ¼ fak ; ak ; . . . ; ak g  A; B e and the e ¼ fba jai 2 Ag that A i s 1 2 e is the union of the line segments connected by polygon P e consecutively such that P e has selfthe points in B intersections, where k1 ¼ 0; ks ¼ n. Then there exists a lifting function k : A # R such that k induces a regular decomposition of A

S k :¼ ffak1 ; ak2 g ; fak2 ; ak3 g; . . . ; faks1 ; aks gg:

ð3:1Þ

It is easy to check that the regular control curve F A;x;B ðS k Þ e For example, for the control polygon of induced by S k is P. a quartic rational Bézier curve as shown in Fig. 5(c), we can e ¼ f0; 2; 3; 4g, regular decomposition of A is set A

e is Sk ¼ ff0; 2g; f2; 3g; f3; 4gg and regular control curve P the union of the line segments connected by the points e ¼ fb0 ; b2 ; b3 ; b4 g. By Theorem 2, we have in B

e: lim FA;xk ðtÞ;B ðx; tÞ ¼ FA;x;B ðS k Þ ¼ P

t!þ1

e This From the assumption, there is a self-intersection of P. implies that there exists t  2 R> , such that the rational Bézier curve FA;xk ðt Þ;B ðx; t Þ has a self-intersection and this leads to a contradiction. If P satisfies the condition (b) in Definition 3, without losses of generality, we assume the intersection of line e and the interior of the tetrahesegment L ¼ ba ba of P kj

kjþ1

dron conv fbak ; bak i

iþ1

; bak

iþ2

; bak

iþ3

g is nonempty, where

kj > kiþ3 . Then there exists a lifting function such that it induces a regular decomposition of A

S k :¼ ffak1 ; ak2 g; . . . ; faki ; akiþ1 ; akiþ2 ; akiþ3 g; . . . ; fakj ; akjþ1 g; . . . ; faks1 ; aks gg:

ð3:2Þ

Therefore, the regular control curve F A;x;B ðS k Þ induced by S k is the union of some line segments and a cubic rational Bézier curve Fi indexed by faki ; akiþ1 ; akiþ2 ; akiþ3 g and the control points fbak ; bak ; bak ; bak g. Let the point Q lies on i

iþ1

iþ2

iþ3

the intersection of L ¼ bak ; bak j

hedron conv fbak ; bak i

iþ1

; bak

iþ2

jþ1

; bak

and the interior of tetraiþ3

g. By Lemma 1, we

choose the weights for faki ; akiþ1 ; akiþ2 ; akiþ3 g properly such that the Fi goes through the point Q . We replace the initial weights for faki ; akiþ1 ; akiþ2 ; akiþ3 g by those weights, then the new regular control curve F A;x;B ðS k Þ has a self-intersection. This implies that there exists t  2 R> , such that the rational Bézier curve FA;xk ðt Þ;B ðx; t Þ has a self-intersection and this leads to a contradiction. If the intersection of line segment e lies in a triangle conv fba ; ba ; ba g, the result L of P ki

kiþ1

kiþ2

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

6

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

(a)

(b)

(c)

Fig. 6. Degree elevation of rational Bézier curves.

can be proved in the same way and we will omit the details here. The proof for the sufficiency is simple. Suppose the control polygon of a rational Bézier curve is well-posed. From [14], the degree elevation of rational Bézier curve cannot increase the number of self-intersections of control polygon. Note that the condition (b) in Definition 3 is e such equivalent to the condition that there exists P that the intersection of some line segment L ¼ bak bak of

e P

with

conv fbak

iþ1

the

interior

of

conv fbak1 ;...;bak

i1

i

iþ1

g

or

;...;baks g is not empty. Since the degree eleva-

tion of the control polygon is the corner-cutting procedure, each line segment Lð1Þ ¼ ba ð1Þ ba ð1Þ k

i

k iþ1

of the new control

polygon Pð1Þ obtained by the degree elevation interor sects the interior of conv fba ð1Þ jakð1Þ 6 akð1Þ g k j

j

i

conv fba ð1Þ jakð1Þ P akð1Þ g of this control polygon is empty. k

j

j

i

This means the control polygon preserves the well-posedness after the degree elevation. Fig. 6 shows the degree elevation procedure for some rational Bézier curves. From Theorem 1, the limit of sequence of the control polygons generated by the degree elevation is the rational Bézier curve. This means the curve has no self-intersection and completes the proof. Theorem 3 gives a geometric condition for checking the injectivity of rational Bézier curve for arbitrary positive weights. Actually, it is not easy to check the well-posedness of the control polygon by computer using Definition 3 if n is large. As is well known, the barycentric coordinate method is used to construct the Bézier simplices (refer to [1,15,16]). For a point P and a simplex S  Rn , then Rn is divided into 2n þ 3 parts by the hyperplanes of facets of S, and we can determine which part the point P lies in by the signs of barycentric coordinate of P in S. For A ¼ fa0 ; a1 ; . . . ; an g and the control points B ¼ fbai jai 2 A; i ¼ 0; 1; . . . ; ng, by the barycentric coordinate method (area and volume coordinates for 2D and 3D simplices respectively), the idea for the algorithm to check the well-posedness of the control polygon is listed below. (1) Selecting 4 different control points bai ; baj ; bak ; bal from B, where ai < aj < ak < al . (2) If the polygon consisted of bai baj ; baj bak ; bak bal has intersections, then the control polygon is non-wellposed, else continue.

Fig. 7. The computation time.

(3) Calculating the barycentric coordinates of any con  trol point bas in the conv bai ; baj ; bak ; bal , where as > al . Then we can determine whether some part of line

segment bal bas lies in the interior of   conv bai ; baj ; bak ; bal or not by the signs of those bary-

centric coordinates. If line segment bal bas lies in the   interior of conv bai ; baj ; bak ; bal for some as > al , then the control polygon is non-well-posed and terminates the algorithm. (4) Otherwise, selecting another 4 different control points bai ; baj ; bak ; bal from B, where ai < aj < ak < al , go to step 2). Note that in step (2), if the points bai ; baj ; bak ; bal from B lie on the same plane, the algorithm is also effective. We can determine whether the point bas lies in one of the triangles formed by any 3 points of fbai ; baj ; bak ; bal g by the signs of its barycentric coordinates. It is easy to check that this algorithm is equivalent to Definition 3 and much easier to implement. We will find the robust and effective algorithm in the future since the complexity of the algorithm is Oðn5 Þ. Actually, although the complexity of the algorithm is high

Table 1 Computation time. n

10

102

103

104

105

Time (s)

0.028

0.03

0.032

0.035

0.0413

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

when n is large, the algorithm will terminate quickly if the control polygon is non-well-posed (see Fig. 7). Example 5. Table 1 shows the computation time for checking the well-posedness of the control polygons with n control points, where the control points are generated randomly and n ¼ 10; 102 ; 103 ; 104 ; 105 . In this example, we use the MATLAB R2013b, and computer with Intel Core 2 Duo 2.53 GHz processor and 4.00 GB RAM. By Theorem 3, we can get the following result directly. Corollary 1. For the set of finite integers A  Z and control points B ¼ fbai jai 2 Ag, if the control polygon is nonwell-posed, then there exists a choice of weights x ¼ fxai jai 2 Ag  R> such that the rational Bézier curve n X

xai bai bai ;A ðxÞ

FA;x ;B ðxÞ ¼

i¼0 n X

x

;

x2D

 b ai ai ;A ðxÞ

7

Example

7. Suppose A ¼ f0; 1; 2; 3; 4g, the weights and the control points B ¼ fb0 ; b1 ; b2 ; b3 ; b4 g. As shown in Fig. 9(a), the control polygon is non-well-posed. Suppose the lifting function k has the assignments f2; 2; 2; 2; 1g at the points f0; 1; 2; 3; 4g, then the regular decomposition of A is S k ¼ ff0; 1; 2; 3g; f3; 4gg and the regular control curve FA;x;B ðS k Þ is the union of a cubic rational Bézier curve R1 (determined by control points b0 ; b1 ; b2 ; b3 and their

x ¼ f1; c; d; 4; 1g

weights) and the line segment b3 b4 . Since the line segment b3 b4 goes through the tetrahedron conv ðb0 ; b1 ; b2 ; b3 Þ, by Lemma 1, we can choose the weights c; d properly (we chose c ¼ 4; d ¼ 4 here) such that the cubic rational Bézier curve R1 intersects b3 b4 (see Fig. 9(b)). This means the regular control curve has a self-intersection. Then there exists t 2 R> such that rational Bézier curve FA;xk ðt Þ;B ðx; t Þ has a self-intersection. Fig. 9(b) shows the curve with a selfintersection with t ¼ 10.

i¼0

Example

has self-intersections. Example

6. Let

8. Suppose A ¼ f0; 1; 2; 3; 4g, the weights and the control points B ¼ fb0 ; b1 ; b2 ; b3 ; b4 g. As shown in Fig. 10(a), the control polygon is non-well-posed. Suppose the lifting function k is the same as in Example 7 and use the same method in Example 7, we can get a rational Bézier curve FA;xk ðt Þ;B ðx; t  Þ has a self-intersection (see Fig. 10(b)) with c ¼ 4; d ¼ 4; t ¼ 1. In 1989, Lasser [3] claimed that if the sum of the rotaP tion angles of the control polygon jak j > p, then the Bézier curve may have self-intersections. By this claim,

x ¼ f1; c; d; 4; 1g

A ¼ f0; 1; 2; 3; 4g,

the

weights

x ¼ f1; 4; 4; 4; 1g and the control points B ¼ fb0 ; b1 ; b2 ; b3 ; b4 g. The control polygon has a self-intersection (see Fig. 8(a)). Suppose the lifting function k has the assignments f0; 1; 1:5; 1; 0g at the points f0; 1; 2; 3; 4g, then the regular decomposition of A is S k ¼ ff0; 1gf1; 2g; f2; 3g; f3; 4gg and the regular control curve FA;x;B ðS k Þ is the control polygon itself. The rational Bézier curve FA;xk ðt Þ;B ðx; t Þ has a selfintersection for t  ¼ 1, as shown in Fig. 8(b).

Fig. 8. The rational Bézier curve with a self-intersection.

Fig. 9. The rational Bézier curve with a self-intersection.

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

8

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx

Fig. 10. The rational Bézier curve with a self-intersection.

From the proof of the Theorem 3, a simple method to calculate the weights is provided. For the non-well-posed control polygon P,

Fig. 11. The rotation angles of control polygon and the rational Bézier curve.

there may exist self-intersections for the Bézier curve defined by the control polygon as Fig. 11(a) shown. However, by Theorem 3, we can declare that the rational Bézier curve with this control polygon has no self-intersection for arbitrary positive weights because it is well-posed (see Fig. 11(a) for instance). Corollary 1 gives the existence of the weights such that the rational Bézier curve has self-intersections if the control polygon is non-well-posed. For practical application, it is important to solve the calculation of the weights such that the curve defined by a non-well-posed control polygon has self-intersections is a very important problem. And a key step is to determine the distance between the curve and its control polygon. Nairn et al. [17] and Karavelas et al. [18] provided a method to estimate the distance between the polynomial Bézier curve and its control polygon. They firstly parameterize the control polygon, and then estimate the distance between the curve and the control polygon by the parametrization of the curve and the second-order difference of the control polygon. However, the parametrization of rational Bézier curve varies during the toric degeneration of the curve, then the method proposed in [17,18] is not suitable for solving this problem. Note that if the control polygon is non-well-posed, there are too many choices of weights such that rational Bézier curve has selfintersections. Therefore, for the given curve (given control polygon and weights), how to check whether rational Bézier curve has self-intersections or not is another complicated problem. The knowledge from Geometric Combinatorics may be found useful in the process of checking, such as the results of regular triangulation in [19] for instance.

(1) if P satisfies the condition ðaÞ in Definition 3, then we can get a regular decomposition S k of A as (3.1) shown, and the regular control curve FA;x;B ðS k Þ is the union of line segments with self-intersections (such as Example 6); (2) if P satisfies the condition ðbÞ in Definition 3, we can get a regular decomposition S k of A as (3.2) shown, and the regular control curve FA;x;B ðS k Þ has self-intersection (such as Examples 7 and 8). By Theorems 2 and 3, there exists t  2 R> such that the rational Bézier curves FA;xk ðtÞ;B ðx; tÞ has a self-intersection while t > t  . Generally, we can get the curve FA;xk ðt Þ;B ðx; t  Þ with self-intersections for a relatively large positive t since the curve converges to its regular control curve exponentially. For instance, the curve has a selfintersection for t  ¼ 10 in Example 7 and the curve has a self-intersection for t  ¼ 1 in Example 8. However, how to give the lower bound of t is still unknown. Acknowledgments The author appreciates the comments and valuable suggestions from the anonymous reviewers. Their advice helped improve the presentation of this paper. This work is partly supported by the National Natural Science Foundation of China–China (No. 11271060), Fundamental Research of Civil Aircraft–China (No. MJ-F-2012-04), and the Fundamental Research Funds for the Central Universities–China (No. DUT14YQ111). References [1] G. Farin, Curve and Surfaces for CAGD: A Practical Guide, Fourth edtion., Academic Press, Orlando, 1996. [2] G. Farin, Algorithms for rational Bézier curves, Comput.-Aided Des. 15 (2) (1983) 73–77. [3] D. Lasser, Calculating the self-intersections of Bézier curves, Comput. Ind. 12 (3) (1989) 259–268. [4] W. Tiller, E. Hanson, Offsets of two-dimensional profiles, IEEE Comput. Graphics Apppl. 4 (9) (1984) 36–46.

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001

C.-G. Zhu, X.-Y. Zhao / Graphical Models xxx (2014) xxx–xxx [5] C.M. Hoffmann, Geometric and Solid Modeling, Morgan Kaufmann, San Mateo, 1989. [6] T. Goodman, K. Unsworth, Injective bivariate maps, Ann. Numer. Math. 3 (1996) 91–104. [7] Y. Choi, S. Lee, Injectivity conditions of 2D and 3D uniform cubic BSpline functions, Graphical Models 62 (2000) 411–427. [8] G. Craciun, L. García-Puente, F. Sottile, Some geometrical aspects of control points for toric patches, in: M. Dählen et al. (Eds.), Mathematical Methods for Curves and Surfaces, Lecture Notes in Computer Science, vol. 5862, Springer, Heidelberg, 2008, pp. 111–135. [9] F. Sottile, C.G. Zhu, Injectivity of 2D toric Bézier patches, in: R. Martin, et al., (Eds.), Proceedings of 12th International Conference on Computer-Aided Design and Computer Graphics, 15–17 September, 2011, IEEE CPS, Jinan, China, pp. 235–238. [10] C.G. Zhu, L. Yang, X.Y. Zhao, B.Y. Xia, Self-intersection of Rational Bézier curve, J. Comput.-Aided Des. Comput. Graphics 25 (5) (2013) 738–744. [11] R. Krasauskas, Toric surface patches, Adv. Comput. Math. 17 (1-2) (2002) 89–113.

9

[12] L. García-Puente, F. Sottile, C.G. Zhu, Toric degenerations of Bézier patches, ACM Trans. Graphics 30 (5) (2011) (Article110). [13] P. Davis, Interpolation and Approximation, Dover Publications, New York, 1975. [14] J. Gravesen, Differential Geometry and Design of Shape and Motion, Department of Mathematics, Technical University of Denmark, 2002, . [15] G. Farin, Triangular Bernstein–Bez´ier patches, Comput. Aided Geom. Des. 3 (1986) 83–128. [16] C. de Boor, B-form basics, Geom. Model. 2 (1987) 27–49. [17] D. Nairn, J. Peter, L.D. Sharp, Quantitative bounds on the distances between a polynomial piece and its Bézier control polygon, Comput. Aided Geom. Des. 16 (7) (1999) 613–633. [18] M.I. Karavelas, P.D. Kalis, K.V. Kostas, Bounding the distance between 2D parametric Bézier curves and their control polygon, Computing 72 (1/2) (2004) 117–128. [19] B. Sturmfels, Gröbner Bases and Convex Polytopes, Amer. Math. Soc., Providence, 1996.

Please cite this article in press as: C.-G. Zhu, X.-Y. Zhao, Self-intersections of rational Bézier curves, Graph. Models (2014), http://dx.doi.org/ 10.1016/j.gmod.2014.04.001