<<

568

Shape Analysis of Cubic Bézier – Correspondence to Four Primitive Cubics

Takafumi Saito1, Midori Yamada2 and Norimasa Yoshida3 1,2Tokyo University of Agriculture and Technology, [email protected] 3Nihon University, [email protected]

ABSTRACT

In this paper, we show that any planar cubic Bézier can be described as an affine transformation of a part of four primitive cubics (x3 + x2 − 3y2 = 0, x3 − 3y2 = 0, x3 − x2 − 3y2 = 0, and x3 − y = 0), and propose an algorithm to derive the transformation matrix. For a given cubic Bézier curve, we derive the linear moving line that follows the curve, and find the double D of the curve. If D is not a point at infinity, we derive the quadratic parallel moving line that follows the curve. By testing whether the quadratic moving line crosses D or not, we classify the curve into three cases (, ,oracnode) which correspond to three primitive cubics. If D is a point at infinity, the curve is classified as fourth case (explicit cubic), which requires exceptional process. For each case, the affine transformation matrix between the primitive cubic and given Bézier curve can be derived. We confirm that the proposed algorithm never fails unless the cubic Bézier curve is degree reducible or consists of four collinear control points.

Keywords: moving line, double point, crunode, cusp, , inflection point

1. INTRODUCTION condition for polynomial (i.e. non-rational) cubic Bézier curves by experimental analysis [3]and For highly aesthetic curve design, it is important extended it to rational cubic Bézier [4]. Unfortunately, to control properties. In addition to tan- these results are not intuitive. This is due to the com- gent and curvature continuities, a fair curve should plicated relationship between geometry of control have the property that its curvature varies mono- points and curvature variation of the curve. tonically [5]. As a higher level property, Harada et In our project, we plan to investigate the curva- al. analyzed many existing aesthetic curves in real ture variation properties for the whole set of planar objects, and found that the logarithmic curvature his- polynomial cubics instead of curve segments. Here, togram (or logarithmic curvature graph,LCG)ofsuch the whole set consists of limited number of primitive aesthetic curve tends to be linear [6]. Yoshida et al. cubics with affine transformation. By investigation of proposed an interactive method to control a curve each primitive cubic and its scaling and skewing, cur- segment with linear LCG [12]. Such kind of curves, vature properties of cubic curve segments can be called log-aesthetic curves, has potential to be uti- surveyed completely. In this paper, as the prepara- lized in future CAD system, especially in initial design tion of the project, we clarify the correspondence stage. For sophisticated CAD operations, however, between Bézier curves and the four primitive cubics: log-aesthetic curves are not suitable as in original x3 + x2 − 3y2 = 0, x3 − 3y2 = 0, x3 − x2 − 3y2 = 0, and form, and need to be approximated with conven- x3 − y = 0. First, we classify cubic Bézier curves into tional parametric curves [13]. Therefore, higher level four cases by checking the singularities. Then, we curvature analysis is required for parametric curves. show that the whole set of cubic Bézier curves is However, analysis of curvature variation of para- equivalent to the four primitive cubics and their affine metric curves is quite difficult. For example, as the transformation, which is our main contribution. simplest subject in such analysis, monotonic curva- ture condition of planar cubic Bézier curve has been 2. RELATED WORKS studied. Walton et al. proposed a selected family of cubic Bézier curves that guaranties monotonic curva- It is well-known that parametric curve segments may ture [10]. Dietz presented G1 Hermite interpolation have inflection points, loops and cusps. These are

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 569 usually undesirable features for curve design. Sev- 4. CLASSIFICATION OF CUBIC BÉZIER CURVES eral studies have been done to derive conditions of In this section, for given four control points P , P , P these features and/or classification of curves, espe- 0 1 2 and P on a plane, we show that the Bézier curve P(t): cially for cubic curve segments [7,9,11]. For example, 3 Stone et al. presented the geometric condition of 3 2 2 3 P(t) = (1 − t) P0 + 3(1 − t) tP1 + 3(1 − t)t P2 + t P3 Bézier control points whether inflection points or sin- (4.1) gularities exist in the curve segment [9]. On the other hand, we focus on whole cubic curves instead of can be described as an affine transformation of a part 3 2 2 3 2 curve segments, find singularities, classify them into of four primitive cubics (x + x − 3y = 0, x − 3y = 3 2 2 3 four categories, and show the correspondence to four 0, x − x − 3y = 0, and x − y = 0) shown in Fig. 1. primitive cubics. Here, any cubic Bézier curve is acceptable unless it Our research is also related to ideal basis of pla- is degenerate; i.e. if the curve satisfies the following nar curves. Sederberg et al. presented that a cubic conditions: Bézier curve is intersection of two moving lines that • are linear and quadratic, and a quartic Bézier curve is It is not degree reducible; • intersection of two quadratic moving lines (or linear All of its four control points are not collinear. one and cubic one in special case) [8]. Cox et al. gen- eralized this idea as the ideal basis of rational curves, Selection of these four primitive cubics will be dis- which is named μ-basis [2]. They showed that the ideal cussed in subsection 5.3. of any degree n planar rational curve can be gener- The outline of the algorithm is as follows. First, L ( ) ated by two that are degree n and n in we derive the linear moving line 0 t that follows 1 2 P( ) D t,wheren + n = n.Chenet al. proposed an efficient the Bézier curve t , and find the double point 1 2 D algorithm to compute a μ-basis of a rational curve [1]. of the curve. If is not a point at infinity, we derive L ( ) Our proposed method is an application of μ-basis, the quadratic parallel moving line 1 t that follows P( ) and we focus on polynomial cubic curves. For each the curve t . By testing whether the moving line L ( ) D curve, we find a specific μ-basis that enables to clarify 1 t crosses the double point or not, we classify the correspondence to the primitive cubics. the curve into three cases (crunode, cusp,oracn- ode). Each case corresponds to each primitive cubic (x3 + x2 − 3y2 = 0, x3 − 3y2 = 0, or x3 − x2 − 3y2 = 0). If D is a point at infinity, the curve is classified as 3. MOVING LINES fourth case (explicit cubic) and corresponds to the primitive cubic x3 − y = 0. In this case, we derive the In this paper, most part of the theory is based on mov- quadratic moving line L (t) that contains the inflec- ing line (family of lines on Bernstein basis) [8]. Here 2 tion point I of the curve. For each case, by using are some definitions and properties of point, line, the correspondence of three reference points (D or Bézier curve, and moving line in 2D homogeneous I, and two other characteristic points), from which coordinate. we obtain the affine transformation matrix M between the primitive cubic and given Bézier curve P(t).

• Point: P = (XYW) = w (xy1). • Line: L = (abc) : aX + bY + cW = 0. 4.1. Double Point and Linear Moving Line • P L P · L = Point lies on line : 0. A moving line L(t) that goes through a fixed point K • L P P L = Line contains two points 0 and 1 : k and follows the curve P(t) can be obtained as, P0 × P1,wherek is a constant. L( ) = K × P( ) • Point P is the intersection of two lines L0 and t t . (4.2) L P = L × L 1 : k 0 1. n n This is generally a cubic moving line. However, if the • Bézier curve P (t) (degree n): P (t) = = B (t)Pi, i 0 i fixed point is on the curve, i.e. K = P(τ), the moving where Pi(0 ≤ i ≤ n) are control points, and line L(t) has a common factor and is substantially n( ) = n ( − )n−i i Bi t 1 t t . quadratic [8]: i n • L( ) L( ) = n( ) L 2 2 Moving line t (degree n): t i=0 Bi t i, L(t) = P(τ) × P(t) = (t − τ) (1 − τ) (1 − τ)τ τ where Li(0 ≤ i ≤ n) are control lines. ⎡ ⎤ Q × Q Q × Q Q × Q • Curve P(t) follows moving Line L(t) (or moving 0 1 0 2 0 3 × ⎣Q × Q Q × Q + Q × Q Q × Q ⎦ line L(t) follows curve P(t)), i.e. for all t,the 0 2 0 3 1 2 1 3 Q × Q Q × Q Q × Q point P(t) lies on the line L(t) : P(t) · L(t) = 0. 0 3 1 3 2 3 • Moving line L(t) follows two curves P (t) and ⎡ ⎤ 0 (1 − t)2 P (t) : k(t)L(t) = P (t) × P (t),wherek(t) is a 1 0 1 × ⎣(1 − t)t⎦ (4.3) scalar of t. t2 • Curve P(t) is the intersection of two moving lines L (t) and L (t) : k(t) P (t) = L (t) × L (t). Q = P Q = P Q = P Q = P 0 1 0 1 where 0 0, 1 3 1, 2 3 2, 3 3.

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 570

(a) (b) (c) (d)

Fig. 1: Four Primitive cubics.

Furthermore, if P(τ) is the double point of the linear as follows. From L( ) cubic curve, t becomes substantially linear [8]. (Q × Q ) × (Q × Q ) In order to classify the Bézier curve P(t),wefirst 0  1 2 3   = Q · (Q × Q ) Q − Q · (Q × Q ) Q find such linear moving line that follows the curve. In 3 0 1 2 2 0 1 3, L( ) P( )     Eqn. (4.3), t follows t . Thus, = Q · (Q × Q ) Q − Q · (Q × Q ) Q 1 2 3 0 0 2 3 1 [(1 − τ)2 (1 − τ)τ τ2] ⎡ ⎤ we obtain Q × Q Q × Q Q × Q 0 1 0 2 0 3 Q − Q + Q = Q ⎣Q × Q Q × Q + Q × Q Q × Q ⎦ V023 1 V013 2 V012 3 V123 0, (4.8) × 0 2 0 3 1 2 1 3 Q × Q Q × Q Q × Q ∴ (Q × Q ) − (Q × Q ) + (Q × Q ) 0 3 1 3 2 3 V023 0 1 V013 0 2 V012 0 3 ⎡ ⎤ 2 = (Q × Q ) = (1 − t) V123 0 0 0. (4.9) × ⎣(1 − t)t⎦ · P(t) = 0. (4.4) t2 By substituting Eqn. (4.9)inEqn.(4.6),  (Q × Q ) − (Q × Q + Q × Q ) Since Eqn. (4.4) is satisfied for any τ, V023 0 2 V013 0  3 1 2 ⎧ +V (Q × Q ) (1 − t) + V (Q × Q )     012 1 3 023 0   3 . ⎪ Q × Q ( − )2 + Q × Q ( − ) −V (Q × Q ) + V (Q × Q ) t t ⎪ 0 1 1 t 0 2 1 t t 013 1 3 012 2 3 ⎪   ·P(t) = 0 ⎪ + Q × Q 2 · P( ) = ⎪ 0 3 t t 0 (4.10) ⎪     ⎨ Q × Q ( − )2 + Q × Q + Q × Q ( − ) Therefore, we have found the linear moving line L (t) 0 2 1 t 0 3 1 2 1 t t 0   . that follows the Bézier curve P(t): ⎪ + Q × Q 2 · P( ) = ⎪ 1 3 t t 0 ⎪   L ( ) = ( − )L + L ⎪ Q × Q ( − )2 0 t 1 t 00 t 01 ⎪ 0 3 1 t  ⎪     ⎧ ⎩ + Q × Q ( − ) + Q × Q 2 · P( ) = ⎪L = V (Q × Q ) − V (Q × Q + Q × Q ) 1 3 1 t t 2 3 t t 0 ⎪ 00 023 0 2 013 0 3 1 2 ⎨ + (Q × Q ) (4.5) V012 1 3 ⎪L = V (Q × Q ) − V (Q × Q ) By making a linear combination of the three equations ⎩⎪ 01 023 0 3 013 1 3 + (Q × Q ) in Eqn. (4.5), V012 2 3  (4.11) (Q × Q ) − (Q × Q ) V023 0 1 V013 0 2     The double point D = w x , y ,1of the curve + (Q × Q ) ( − )2 + (Q × Q ) D D D V012 0 3 1 t V023 0 2 P(t) can be obtained as the intersection of two control − V (Q × Q + Q × Q ) lines of the linear moving line: 013 0 3  1 2  + (Q × Q ) ( − ) + (Q × Q ) , (4.6) V012 1 3 1 t t V023 0 3 D = L00 × L01. (4.12)   − (Q × Q ) + (Q × Q ) 2 V013 1 3 V012 2 3 t Fig. 2 shows an example. From four control points of a Bézier curve, we can obtain two control lines · P(t) = 0 L00 and L01 of the linear moving line, and the double D where point .   The double point D could be a point at infinity. In V = Q · Q × Q (4.7) ijk i j k next subsections 4.2 and 4.3, we deal with the case In Eqn. (4.6), the first factor looks a quadratic mov- that D is not at infinity. In subsection 4.4, we treat the ing line, however, we can show that it is substantially case that D is at infinity.

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 571

Since P(t) is not rational, weight of each control point Pi is 1. Therefore, each factor in Eqn. (4.15)canbe described as follows: ⎧   ⎪P − P + P − P = ⎨⎪ 3 3 2 3 1 0 xd0123 , yd0123,0 P − P = ⎪ 1 0 xd01, yd01,0 . ⎪ ⎩P − P = 3 2 xd23, yd23,0 (4.16) ⎧    ⎨L − L = 3 − 11 10 0, 0, xd01yd0123 yd01xd0123 ∴  2   . ⎩L − L = 3 − Fig. 2: Linear moving line that follows a cubic Bézier 12 11 0, 0, 2 xd23yd0123 yd23xd0123 curve. (4.17)

From Eqn. (4.17) each control line of L1(t) can be 4.2. Quadratic Parallel Moving Line and Its expressed: Existence Area ⎧   ⎪L = If the double point D is not at infinity, P(∞) is not a ⎨⎪ 10 a1, b1, c10 double point. Thus, by setting K = P(∞) in Eqn. (4.2), L = ⎪ 11 a1, b1, c11 , (4.18) L ⎪ we can derive the quadratic parallel moving line 1[t] ⎩L = that follows the curve P(t).FromEqn.(4.3), 12 a1, b1, c12   ∴ L ( ) = ( ) P(τ) × P( ) 1 t a1, b1, c1 t t 2 2 , (4.19) lim c1(t) = (1 − t) c10 + 2(1 − t)tc11 + t c12 τ→∞ (t − τ)τ2 = − where a1 and b1 are constants. This means the motion 1 11 L ( ) ⎡ ⎤ of 1 t is a parallel translation of a line, and quadratic Q × Q Q × Q Q × Q ( ) L ( ) 0 1 0 2 0 3 function c1 t gives the position. Therefore, 1 t ⎣Q × Q Q × Q + Q × Q Q × Q ⎦ π L ( ) × 0 2 0 3 1 2 1 3 exists in a certain half plane E ;ast increases, 1 t Q × Q Q × Q Q × Q π 0 3 1 3 2 3 approaches to the border of E , reaches the border ⎡ ⎤ at t = t , then returns to the beginning side. The ( − )2 . E 1 t parameter value t is obtained by: × ⎣(1 − t)t⎦ E 2 ˙ t L1(tE ) = 0, (4.20)   − = −Q × Q + Q × Q − Q × Q ( − )2 c10 c11 0 1 0 2 0 3 1 t ∴ t = . (4.21)   E c − 2c + c + −Q × Q + Q × Q + Q × Q − Q × Q 10 11 12 0 2 0 3 1 2 1 3 P( ) L ( )   The curve t is to the border line 1 tE ,and × ( − ) + −Q × Q + Q × Q − Q × Q 2 1 t t 0 3 1 3 2 3 t the tangent point E = wE xE , yE ,1is obtained as: (4.13) E = L0(tE ) × L1(tE ). (4.22)

Thus, the quadratic parallel moving line L1(t) is: Fig. 3 shows an example. From four control points of a Bézier curve, we can obtain three control lines L ( ) = ( − )2L + ( − ) L + 2L 1 t 1 t 10 2 1 t t 11 t 12 L10, L11 and L12 of the quadratic parallel moving line, ⎧   the borderline L (t ) of the half plane π ,andthe ⎪L = −Q × Q + Q × Q − Q × Q 1 E E ⎪ 10  0 1 0 2 0 3 tangent point E. ⎨L = 1 −Q × Q + Q × Q + Q × Q . 11 2 0 2 0 3 1 2 ⎪ −Q × Q ⎩⎪ 1 3  L = −Q × Q + Q × Q − Q × Q 12 0 3 1 3 2 3 (4.14)

Here, the differences of adjacent control line pairs can be expressed: ⎧     L − L = 1 Q − Q × Q − Q + Q − Q ⎪ 11 10 1 3 0 3 2 1 0 ⎨⎪  2    = 3 P − P × P − 3 P + 3 P − P 2 1 0 3  2 1 0  . ⎪L − L = 1 3Q − Q × Q − Q + Q − Q ⎩⎪ 12  11 2  3 2 3 2  1 0 = 3 P − P × P − 3 P + 3 P − P 2 3 2 3 2 1 0 Fig. 3: Quadratic parallel moving line that follows a (4.15) cubic Bézier curve.

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 572

4.3. Classification, Reference Points, and Affine ˆ˙ ˆ ˆ L1(0) = 0. Therefore, L1(t) can be described as: Transformation from Primitive Cubic ˆ ˆ ˆ 2 ˆ ˆ ˆ ˆ ˆ2 ˆ The feature of the double point D depends on its rela- L1(t) = (1 − t) L10 + 2(1 − t)tL11 + t L12 π D ⎧   tionship to the half plane E , i.e. whether is inside, ⎪ ˆ ˆ π P( ) ⎪L10 = kL1 P(∞) × E outside, or on the border of E .Onthecurve t , ⎨   . (4.27) the parameter value t at the double point D can be Lˆ = k P(∞) × Eˆ ⎪ 11 L1   obtained by a quadratic equation: ⎩⎪ ˆ ˆ L12 = kL1 P(∞) × D

L (t) · D = 0. (4.23) 1 where kL1 is a constant. The intersection of these moving lines: Let D be the discriminant of Eqn. (4.23). Then the Pˆ (ˆ) = Lˆ (ˆ) × Lˆ (ˆ) sign of D corresponds to the relationship between D t 0 t 1 t (4.28) and π , from which the curve P(t) can be classified as E is equivalent to the curve P(t). follows: This curve Pˆ (tˆ) canbeobtainedbyanaffinetrans- formation of the following primitive cubic:     • D > 0: Case 1. Crunode, P˜ (t˜) = t˜2 − 1, √1 t˜3 − t˜ ,1 (4.29) • D = 0: Case 2. Cusp, C1 3 • D < 0: Case 3. Acnode. or x3 + x2 − 3y2 = 0 (4.30)

because this curve P˜ (t˜) can also be defined from the [Case 1. Crunode] C1 following reference points and moving lines: If D > 0, Eqn. (4.23) has two real roots, which D     means is a crunode (self intersection) because the D˜ = 0, 0, 1 , E˜ = −1, 0, 1 , P( ) D curve t go through the double point twice. Let tF     L ( ) ˜ 1 ˜ be the greater root, then 0 tF is tangent to the curve F = −1, − √ ,1, P∞ = 0, 1, 0 , (4.31) 3 at D.LetF = wF xF , yF ,1be the intersection of L ( ) L ( ) ˜ ˜ ˜ ˜ ˜ ˜ two lines 0 tF and 1 tE : L⎧0(t) = (1 − t)L00+ tL01  ⎨L˜ = D˜ × E˜ = − 00 0, 1, 0  , (4.32) F = L ( ) × L ( ) 1 0 tF 1 tE , (4.24) ⎩L˜ = D˜ × F˜ = √ , −1, 0 01 3 L˜ (t˜) = (1 − t˜)2L˜ + 2 (1 − t˜)t˜L˜ + t˜2L˜ Next, we make a linear transformation of t: ⎧1 10  11 12 ⎪L˜ = P˜ × E˜ = ⎨⎪ 10 ∞ 1, 0, 1 ˜ ˜ ˜ , (4.33) t − t L = P∞ × E = 1, 0, 1 tˆ = E , (4.25) ⎪ 11   t − t ⎩⎪ ˜ ˜ ˜ F E L12 = P∞ × D = 1, 0, 0 ˜ ˜ ˜ ˜ ˜ ˜ ˆ ˆ ˆ ˆ P (t) = L0(t) × L1(t). (4.34) and let L0(t) and L1(t) be equivalent moving lines to L (t) and L (t), respectively. Here, Lˆ (0) is equivalent 0 1 0 The affine transformation matrix M that maps to L (t ) which contains D and E, Lˆ (1) is equivalent C1 0 E 0 P˜ (t˜) into P(t) can be obtained so as to map three to L (t ) which contains D and F,andLˆ (∞) is equiv- C1 0 F 0 reference points D˜ , E˜ and F˜ into Dˆ , Eˆ and Fˆ ,respec- alent to L (∞) which contains D and P(∞). Therefore, 0 tively: Lˆ (ˆ) 0 t can be described as: ⎡ ⎤ ⎡ ⎤ D˜ Dˆ ⎢ ⎥ ⎢ ⎥ ˆ ˆ ˆ ˆ ˆ ˆ ⎣E˜ ⎦ M = ⎣Eˆ ⎦ (4.35) L0(t) = (1 − t)L00 + tL01 C1 ⎧   F˜ Fˆ ⎨ ˆ ˆ ˆ L00 = kL0 D × E , (4.26) ⎛ ⎞   x − x y − y 0 ⎩Lˆ = Dˆ × Fˆ √ D E √ D E 01 kL0 ∴ = ⎝ ⎠ MC1 3 (xE − xF ) 3 (yE − yF ) 0 (4.36) xD yD 1   Dˆ = D/ = Eˆ = E/ = where  wD xD, yD,1,  wE and the parameter transformation is: ˆ xE , yE ,1, F = F/wF = xF , yF ,1,andkL0 is a   ˆ = − ˜ + ˜ constant. Likewise, L1(0) is equivalent to L1[tE ]which t 1 t tE ttF . (4.37) contains P(∞) and E, Lˆ (1) is equivalent to L (t ) 1 ˆ 1 F which contains P(∞) and F, L1(∞) is equivalent to Fig. 4 shows an example Bézier curve with a crun- L1(∞) which is the set of points at infinity, and ode and its correspondence to the primitive cubic.

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 573

(a) (a) (b) (b)

Fig. 4: Case 1. Crunode. Fig. 5: Case 2. Cusp.

Here, the whole shape of each curve is drawn in blue, and the parameter transformation is: and parameter interval 0 ≤ t ≤ 1 of original Bézier is drawn in black. ˜ t = t + tE . (4.45) [Case 2. Cusp] If D = 0, Eqn. (4.23) has double roots, which means D is a cusp because the curve P(t) go through the Fig. 5 shows an example Bézier curve with a cusp and its correspondence to the primitive cubic. double point D once. Let tF be = + [Case 3. Acnode] tF tE 1. (4.38) <   If D 0, Eqn. (4.23) has complex roots, which G = means D is an acnode (isolate point) because the Let wG xG, yG,1be the intersection of two P( ) D lines L0(tE ) and L1(tF ),andletF = wF xF , yF ,1be curve t does not go through the double point . G = Gˆ = the intersection of two lines L0(tF ) and L1(tF ): In this case, let xG, yG,1be  G = L0(tE ) × L1(tF ) . (4.39) Gˆ = 2 Eˆ − Dˆ , (4.46) F = L0(tF ) × L1(tF )   In the same way as Case 1, the curve P(t) can be Dˆ = D/ = Eˆ = E/ = where  wD xD, yD,1 and wE obtained by an affine transformation and parameter xE , yE ,1.SinceE is the midpoint of line segment transformation of the following primitive cubic: DG, the point G is inside of the half plane πE and the   following quadratic equation has two real roots: P˜ (t˜) = t˜2, √1 t˜3,1 (4.40) C2 3 3 2 or x − 3y = 0. (4.41) L1(t) · G = 0. (4.47)

By using the correspondence of three reference points = D, G and F, the affine transformation matrix M that LettF be the greater root of Eqn. (4.23), and let F C2 L ( ) maps P˜ (t˜) into P(t) can be obtained as follows: wF xF , yF ,1be the intersection of two lines 0 tF C2 L ( ) ⎡ ⎤ ⎡ ⎤ and 1 tF : D˜ Dˆ ⎢ ˜ ⎥ ⎢ ˆ ⎥ F = L0(tF ) × L1(tF ). (4.48) ⎣G⎦ MC2 = ⎣D⎦ (4.42) F˜ Dˆ In the same way as Case 1, the curve P(t) can be   Dˆ = D/ = Gˆ = G/ = obtained by an affine transformation and parameter where  wD xD, yD,1,  wG ˆ transformation of the following primitive cubic: xG, yG,1, F = F/wF = xF , yF ,1,and           ˜ D˜ = 0, 0, 1 , G˜ = 1, 0, 1 , F˜ = 1, √1 ,1, P (t˜) = t˜2 + 1, √1 t˜3 + t˜ ,1 (4.49) 3 C3 3 (4.43) 3 − 2 − 2 = ⎛ ⎞ or x x 3y 0. (4.50) − − √ xG xD √ yG yD 0 ∴ = ⎝ ( − ) ( − ) ⎠ MC2 3 xF xG 3 yF yG 0 , (4.44) By using three reference points D, G and F, the affine x y 1 ˜ ˜ D D transformation matrix MC3 that maps PC3(t) into P(t)

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 574 can be obtained as follows: From Eqn. (4.14)and(4.47), ⎡ ⎤ ⎡ ⎤ D˜ Dˆ         ⎢ ˜ ⎥ ⎢ ˆ ⎥ P1 − P0 × P1 − P0 − 2 P2 − P1 + P3 − P2 ⎣G⎦ MC3 = ⎣G⎦ (4.51)         F˜ Fˆ = P3 − P2 × P1 − P0 − 2 P2 − P1 + P3 − P2 , (4.58)   ˆ         where F = F/wF = xF , yF ,1,and ∴ P − P × P − P = P − P × P − P 1 0  3 2  1 0 2 1       + P2 − P1 × P3 − P2 . (4.59) D˜ = 0, 0, 1 , G˜ = 2, 0, 1 , F˜ = 2, √2 ,1, 3 (4.52) ⎛ ⎞ By substituting Eqn. (4.59)intoEqn.(4.56), 1 (x − x ) 1 (y − y ) 0 ⎜ 2 G D 2 G D ⎟     ∴ = ⎜ √ √ ⎟ ( − ) P − P × P − P MC3 ⎝ 3 ( − ) 3 ( − ) ⎠ , (4.53) 1 t 1 0 2 1 2 xF xG 2 yF yG 0     + P − P × P − P = xD yD 1 t 2 1 3 2 0. (4.60) and the parameter transformation is: I = Let tI be the root of Eqn. (4.60), then   xI , yI ,1= P(tI ) is the inflection point of P(t).By t = 1 − t˜ t + tt˜ . (4.54) E F substituting τ = tI into Eqn. (4.3), the quadratic mov- ing line L2(t) that contains the fixed point I and Fig. 6 shows an example Bézier curve with a cusp and follows the curve P(t) is: its correspondence to the primitive cubic. 2 2 L2(t) = (1 − t) L20 + 2 (1 − t)tL21 + t L22 ⎧     4.4. Double Point at Infinity ⎪L = ( − )2 Q × Q + ( − ) Q × Q ⎪ 20 1 tI  0 1 1 tI tI 0 2 If the double point D is at infinity, the linear mov- ⎪ + 2 Q × Q ⎪ t 0 3 L ( ) P(∞) L ( ) ⎪ I    ing line 0 t contains and is equivalent to 1 t . ⎨⎪ 1 2 L21 = (1 − tI ) Q × Q Thus, we need a quadratic moving line with another 2  0 2    ⎪ +(1 − t )t Q × Q + Q × Q + t2 Q × Q fixed point. Here, we use the inflection point. Inflec- ⎪ I I 0 3 1 2 I 1 3 P( ) ⎪     tion points of curve t can be obtained by the ⎪L = (1 − t )2 Q × Q + (1 − t )t Q × Q ⎩⎪ 22  I  0 3 I I 1 3 following equation [9]: + 2 Q × Q tI 2 3 P˙ (t) × P¨ (t) = 0, (4.55) (4.61)       2 ∴ (1 − t) P1 − P0 × P2 − P1 + t (1 − t) P1 − P0       [Case 4. Explicit Cubic] 2 × P3 − P2 + t P2 − P1 × P3 − P2 = 0, (4.56) Let tF be = + Since the parallel moving line L1(t) is linear, tF tI 1. (4.62)   L − L = L − L G = 11 10 12 11. (4.57) Let wG xG, yG,1be the intersection of two lines L0(tF ) and L2(tI ),andletF = wF xF , yF ,1be the intersection of two lines L (t ) and L (t ): (a) 0 F 2 F (b)  G = L (t ) × L (t ) 0 F 2 I . (4.63) F = L0(tF ) × L2(tF )

In the same way as Case 1, the curve P(t) can be obtained by an affine transformation and parameter transformation of the following primitive cubic:

  ˜ ˜ ˜ ˜3 PC4[t] = t, t ,1 (4.64) or x3 − y = 0. (4.65)

By using the correspondence of three reference points Fig. 6: Case 3. Acnode. I, G and F, the affine transformation matrix MC4 that

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 575

(a) Suppose Eqn. (4.71)istrue, (b) L = (Q × Q ) − (Q × Q ) 01 V023 0 3 V013 1 3 + V (Q × Q ) = 0 (4.72)  012 2 3  ∴ Q − Q + Q × Q = V023 0 V013 1 V012 2 3 0. (4.73)

From Eqn. (4.8), ∴ Q − Q + Q = Q V123 0 V023 1 V013 2 V012 3 , (4.74) ∴ (Q × Q ) − (Q × Q ) + (Q × Q ) V123 0 3 V023 1 3 V013 2 3 = V (Q × Q ) = 0,  012 3 3  Q − Q + Q × Q = V123 0 V023 1 V013 2 3 0. (4.75)

From Eqn. (4.73)and(4.75), two constants k0 and k1 Fig. 7: Case 4. Explicit cubic. exist such that  Q − Q + Q = Q V023 0 V013 1 V012 2 k0 3 P˜ (˜) P( ) , (4.76) maps C4 t into t can be obtained as follows: Q − Q + Q = Q V123 0 V023 1 V013 2 k1 3 ⎡ ⎤ ⎡ ⎤     ˜ ˆ ∴ − Q − − Q I I k0V123 k1V023 0 k0V023 k1V013 1 ⎢ ˜ ⎥ ⎢ ˆ ⎥   ⎣G⎦ MC4 = ⎣G⎦ (4.66) + − Q = k0V013 k1V012 2 0. (4.77) F˜ Fˆ Here, three points Q , Q and Q are not collinear;     0 1 2 ˆ ˆ if so, the point Q is also on the same line by Eqn. where I = I = xI , yI ,1, G = G/wG = xG, yG,1, 3   (4.76). Thus, Fˆ = F/w = x , y ,1,and F F F ⎧ ⎪       ⎨k0V123 − k1V023 = 0 D˜ = 0, 0, 1 , G˜ = 1, 0, 1 , F˜ = 1, 1, 1 , k V − k V = 0 , (4.78) (4.67) ⎩⎪ 0 023 1 013 ⎛ ⎞ k0V013 − k1V012 = 0 xG − xI yG − yI 0 ⎝ ⎠ ∴ MC4 = xF − xG yF − yG 0 , (4.68) and xI yI 1 k0 = 0, k1 = 0, and the parameter transformation is: V V V k ∴ 123 = 023 = 013 = 1 . (4.79) ˜ V023 V013 V012 k0 t = t + tI . (4.69) From Eqn. (4.7), Fig. 7 shows an example Bézier curve with a dou-     ble point at infinity and its correspondence to the V012 = 9P0 · P1 × P2 , V013 = 3P0 · P1 × P3 , primitive cubic.     V023 = 3P0 · P2 × P3 , V123 = 9P1 · P2 × P3 (4.80)

5. DISCUSSION P P P Let Sijkbe the area of triangle i j k, then, In this section, we discuss some supplementary sub- + = + jects on the theory and implementation. S012 S023 S013 S123 (4.81)

Since the weight of each control point Pi is 1, 5.1. Completeness of Classification 1   S = P · P × P (4.82) In this subsection, we confirm that there is no other ijk 2 i j k possibility than the above four cases. ∴ V012 + 3V023 = 3V013 + V123 (4.83) In Eqn. (4.11), L0(t) can always be calculated, and L ( ) Eqn. (4.10) shows that the result 0 t must satisfy By solving Eqn. (5.1)and(4.83), we obtain the solu- tions: L ( ) · P( ) = 0 t t 0. (4.70) k √ 1 = 1, −2 ± 3. (4.84) k0 If L0(t) is not a linear moving line, it must satisfy However, k1/k0 must be positive; otherwise, two L0(t) = 0 (for ∀t). (4.71) points P2 and P3 must be in the opposite sides of line

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 576

P0P1,twopointsP0 and P3 must be in the opposite curve with following control points Ri: sides of line P1P2, and two points P0 and P1 must be 3 1 3 1 in the opposite sides of line P2P3, so it is impossible R0 = P0, R1 = P1 − P0 = P2 − P3, to locate the four control points. Therefore, 2 2 2 2

R2 = P3. (4.90) k1 = 1. (4.85) As a result, for any cubic Bézier curve P(t), unless k0 it is degenerate, the linear moving line L0(t) and the ∴ V012 = V013 = V023 = V123 (4.86) double point D can be obtained correctly. In Eqn. (4.14), L1(t) can always be calculated, and L ( ) From Eqn. (4.76), Eqn. (4.3)and(4.13) shows that the result 1 t must satisfy   L1(t) · P(t) = 0 (4.91) V012 P0 − 3P1 + 3P2 = k0P3. (4.87) If the latter process fails, L1(t) must satisfy one of the following conditions: Since the weight of each control point Pi is 1,

(1) L1(t) = 0 (for ∀t), = V012 k0 (4.88) (2) L0(t) and L1(t) are equivalent i.e. there exists a scalar function k(t) that satisfies ∴ 3P1 − P0 = 3P2 − P3. (4.89)

L1(t) = k(t) L0(t), (4.92) Eqn. (4.89) shows that the curve P(t) is degree reducible; P(t) is equivalent to the quadratic Bézier (3) L1(t) is actually a linear moving line.

(a) (b) (c)

(d) (e) (f)

(g) (h) (i)

Fig. 8: Example Bézier curves and corresponding primitives.

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 577

(1) must not occur by the following reason. From Eqn. 6. CONCLUSION (4.14), In this paper, we presented that any planar polyno-   mial cubic Bézier curve can be described as an affine L =−P × P − P + P − P 10 0 3 3 2 3 1 0 , (4.93) transformation of a part of four primitive cubics, and propose an algorithm to derive the transformation P Where 0 is a control point that is not at infinity and matrix. By using the linear and the quadratic paral- P3 − 3 P2 + 3 P1 − P0 is a point at infinity. Thus, lel moving lines that follow the Bézier curve, we can determine the type of the double point, from which

L1(0) = L10 = 0. (4.94) the curve is classified into four cases: crunode, cusp, acnode, and explicit cubic. We confirmed that the proposed algorithm never fails unless the curve is (2) is impossible, because L (t) contains a fixed point 0 degenerate. D which is not at infinity, and L (t) contains a fixed 1 Next, we will analyze the curvature properties of point P (∞) at infinity. If (3) is true, the curve P(t) the four primitive cubics and their affine transfor- must be degree reducible. Thus, (3) is also impossible. mation. From this analysis, we will try to show the As a result, for any cubic Bézier curve P(t), unless it aesthetic ability of cubic curves. The extension to is degenerate or the double point D is at infinity, it is rational cubic Bézier is also the future study. classified into one of the three cases in subsection 4.3.

ACKNOWLEDGEMENTS 5.2. Implementation and Experimental Results This work was supported by JSPS KAKENHI Grant We have implemented a program to check the the- Number 23300034. ory in section 4. From given Bézier control points, the program calculates and displays control lines of the moving lines, reference points, correspond- REFERENCES ing primitive, transformation matrix, and parameter [1] Chen, F.; Wang, W.: The μ-Basis of a Planar interval. Since each process is based on closed-form Rational Curve - Properties and Computation, expressions, the computation is in real-time on recent Graphical Models, 64(6), 2002, 368-381. DOI: PC’s. Fig. 8 shows example results, where three con- 10.1016/S1077-3169(02)00017-5 trol points are fixed and the other one is moved. [2] Cox, D.; Sederberg, T. W; Chen, F.: The Mov- For each Bezier curve, corresponding primitive and ing Line Ideal Basis of Planar Rational Curves, parameter interval (black part on the curve) are pre- Computer Aided Geometric Design, 15(8), sented. Also, we have tried to display the Bézier curve 1998, 803–827. DOI: 10.1016/S0167-8396(98) from the result (primitive, transformation matrix, and 00014-4 parameter interval), and confirmed that it is always [3] Dietz, D. A.; Piper, B.: Interpolation with Cubic coincident with the input Bézier curve. Spirals, Computer Aided Geometric Design, Three control points P = (−2, 2, 1), P = (0, 2, 1) 0 1 21(2), 2004, 165-180. DOI: 10.1016/j.cagd. and P = (1, 1, 1) are fixed, and the other one P 2 3 2003.09.002 moves from (1, −1.5, 1) to (1, 0, 1), and the to [4] Dietz, D. A.; Piper, B.; Sebe, E.: Rational cubic (2.25, 0, 1). spirals, Computer-Aided Design, 40(1), 2008, 3–12. DOI: 10.1016/j.cad.2007.05.001 [5] Farin, G. E.; Sapidis, N.: Curvature and the Fair- 5.3. Selection of Primitive Cubics ness of Curves and Surfaces. IEEE Computer The selection of four primitive cubics in Fig. 1 is not Graphics and Applications, 9(2), 1989, 52–57. unique. Each primitive can be replaced with any affine DOI: 10.1109/38.19051 transformed one. In general, symmetrical shapes with [6] Harada, T.; Yoshimoto, F.; Moriyama, M.: An simple coefficients in both implicit and parametric Aesthetic Curve in the Field of Industrial forms would be better for primitives. One of the Design, Proceedings of IEEE Symposium on simplest sets is: Visual Languages, 1999, 38–47. [7] Sakai, M.: Inflection Points and Singularities x3 + x2 − y2 = 0, x3 − y2 = 0, x3 − x2 − y2 = 0, on Planar Rational Cubic Curve Segments, Computer Aided Geometric Design, 16(3), 3 − = and x y 0. (4.95) 1999, 149–156. DOI: 10.1016/S0167-8396(98) 00036-3 The reason we chose the set in Fig. 1 instead of Eqn. [8] Sederberg, T. W.; Saito, T.; Qi, D.; Klimaszewski, (4.95) is that the first primitive x3 + x2 − 3y2 = 0isa K. S.: Curve Implicitization using Moving Pythagorean hodograph curve and its curvature can Lines, Computer Aided Geometric Design 11(6), be presented in simpler form. It may help curvature 1994, 687-706. DOI: 10.1016/0167-8396(94) analysis in the next step of our project. 90059-0

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com 578

[9] Stone, M. C.; DeRose, T. D.: A Geometric Char- Curve, Computer-Aided Design, 13(4), 1981, acterization of Parametric Cubic Curves, ACM 199-206. DOI: 10.1016/0010-4485(81)90141-X Transactions on Graphics, 8(3), 1989, 147-163. [12] Yoshida, N.; Saito, T.: Interactive Aesthetic DOI: 10.1145/77055.77056 Curve Segments, The Visual Computer, 22(9- [10] Walton, D. J.; Meek, D. S.: A Planar Cubic 11) (Proc. of Pacific Graphics), 2006, 896-905. Bézier Spiral, Journal of Computational and DOI: 10.1007/s00371-006-0076-5 Applied , 72, 1996, 85-100. DOI: [13] Yoshida, N.; Saito, T.: Quasi-Aesthetic Curves in 10.1016/0377-0427(95)00246-4 Rational Cubic Bézier Forms, Computer-Aided [11] Wang, C. Y: Shape Classification of the Paramet- Design and Applications, 4(1-4), 2007, 477-486. ric Cubic Curve and Parametric B-Spline Cubic DOI: 10.3722/cadaps.2007.477-486

Computer-Aided Design & Applications, 11(5), 2014, 568–578, http://dx.doi.org/10.1080/16864360.2014.902690 c 2014 CAD Solutions, LLC, http://www.cadanda.com