Next Article in Journal
Bounds of Different Integral Operators in Tensorial Hilbert and Variable Exponent Function Spaces
Previous Article in Journal
Universal Network for Image Registration and Generation Using Denoising Diffusion Probability Model
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Self-Intersections of Cubic Bézier Curves Revisited

by
Javier Sánchez-Reyes
IMACI (Instituto de Matemática Aplicada a la Ciencia e Ingeniería), ETS Ingeniería Industrial Ciudad Real, Universidad de Castilla-La Mancha, 13071 Ciudad Real, Spain
Mathematics 2024, 12(16), 2463; https://doi.org/10.3390/math12162463
Submission received: 10 July 2024 / Accepted: 7 August 2024 / Published: 9 August 2024
(This article belongs to the Section Algebra, Geometry and Topology)

Abstract

:
Recently, Yu et al. derived a factorization procedure for detecting and computing the potential self-intersection of 3D integral Bézier cubics, claiming that their proposal distinctly outperforms existing methodologies. First, we recall that in the 2D case, explicit formulas already exist for the parameter values at the self-intersection (the singularity called crunode in algebraic geometry). Such values are the solutions of a quadratic equation, and affine invariants depend only on the curve hodograph. Also, the factorization procedure for cubics is well known. Second, we note that only planar Bézier cubics can display a self-intersection, so there is no need to address the problem in the more involved 3D setting. Finally, we elucidate the connections with the previous literature and provide a geometric interpretation, in terms of the affine classification of cubics, of the algebraic conditions necessary for the existence of a self-intersection. Cubics with a self-intersection are affine versions of the celebrated Tschirnhausen cubic.

1. Introduction

Integral (i.e., polynomial) cubics are the most popular Bézier curves in CAGD (Computer-Aided Geometric Design) [1,2] for their straightforward analysis and beautiful simplicity [3], especially compared to their rational or higher-order counterparts. Bézier cubics deserve our attention as they find numerous practical applications, including the following:
  • Free-form design: They provide the tool to define freeform paths in vector-based design programs, such as Adobe Illustrator and Inkscape, the page-description language PostScript [4] and the Scalable Vector Graphics (SVG) format [5];
  • Manufacturing: Bézier cubics are implemented as the G5 command in G-code, the standard programming language for CNC (Computer Numerical Control) and additive manufacturing [6];
  • Geometry processing [7]: Cubics can be pieced together to define C 2 splines, which are employed in CAD systems to approximate geometry, such as offsets [8] or sections of sculptured surfaces.
Detecting the curve singularities is critical to these applications. In particular, a curve b ( t ) with a self-intersection S means a loop, which violates the assumptions required for CNC milling [9]. Also, it implies that b ( t ) has zero reach (shortest distance to the cut locus) at S , so no smooth (trimmed) tube or offset can be constructed using b ( t ) as the generator [10]. To compute the potential self-intersection of an integral cubic, we could resort to numerical algorithms for Bézier curves of an arbitrary degree, such as those by Lasser [11] or Farouki [12], based on subdivision. However, for the specific cubic case, simple closed-form formulas are well known.
Yu et al. [13], in a recent article in this journal and unaware of these previous explicit formulas, present an alternative analytical method in a 3D setting, claiming that it overcomes the limitations of existing algorithms. Our article contesting this claim is arranged as follows. First, Section 2 briefly reviews the rich literature, mostly overlooked in [13], on explicit methods for finding the self-intersection of plane cubics. Section 3 shows that solving the 2D case with existing techniques suffices because all Bézier cubics with a self-intersection are planar. Next, Section 4 revisits the factorization procedure employed in [13] and checks the equivalence between existing formulas. Section 5 reinterprets geometrically the algebraic conditions for the existence of a self-intersection in terms of the affine classification of cubics, concluding that all Bézier cubics with a self-intersection can be regarded as affine segments of a Tschirnhausen cubic. Finally, Section 6 closes with practical conclusions.

2. Finding the Self-Intersection of a Cubic: Existing Explicit Procedures

Finding a self-intersection S [14,15] boils down to seeking a double point and, hence, pairs u , v of distinct parameter values ( u v ) such that
b ( u ) = b ( v ) = S .
For integral plane cubics, a quadratic equation furnishes the values u , v corresponding to the only double point. More than four decades ago, Wang [16] (Theorem 3) provided explicit formulas for u , v , albeit for cubics in the power basis. Later, and unaware of [16], Su and Liu [17] (p. 265) put forward the equivalent expression in the Bernstein basis, rewritten by Degen [18] (p. 261) in terms of a pair of affine invariants. These works [16,17,18] do not detail how equality (1) is solved for u , v , simply providing ready-to-use formulas. The methods reported by Thompson [19] or on the Mathematics Stack Exchange website [20] resort to the factorization procedure, also employed by Yu et al. [13].
The solution for integral cubics can be regarded as a particular instance of that by Patterson [21] (p. 151) for the superset of rational cubics. Unsurprisingly, u , v also come as the roots of a quadratic polynomial, the so-called auxiliary quadratic form. Fiorot et al. [22] adapted this result to rational cubics given in the alternative BR-form controlled by a massic polygon via Bernstein polynomials.
Implicitization techniques provide another option to find S . Loop and Blinn [23] obtain a simple implicit representation for rational Bézier curves based on classical algebraic geometry and derive an explicit formula for u , v in the integral case. Chionh and Sederberg [24] extend this result to rational cubics after revealing the connection between singularities and the implicitization Bézout matrix. Barrowclough [25] also gives formulas for the rational case by devising a tailor-made basis for the implicitization of Bézier cubics. As expected, u , v always come as the roots of a quadratic polynomial.

3. All Bézier Cubics with Self-Intersections Are Planar

In this Section, we recall that no twisted (i.e., non-planar) cubic with a self-intersection S exists, a fact overlooked in [13]. Indeed, consider the Bézier form b ( t ) of the loop segment bounded by S (Figure 1), whose control polygon b i i = 0 3 has coincident endpoints b 0 = b 3 = S and, thus, defines a triangle on a certain plane Π containing b ( t ) . Any segment of the cubic also lies on Π , as its control points stem from barycentric combinations of those of b ( t ) .
We can easily check whether a given 3D cubic is planar by inspecting its derivative, called a hodograph [1]. This hodograph is expressible in quadratic Bézier form, with three control points, aside from a common dilation, generated by the forward difference operator Δ as follows:
Δ b k = b k + 1 b k , k = 0 , 1 , 2 .
Therefore, the planarity of b ( t ) is tantamount to a vanishing determinant as follows:
| D | = 0 , D = Δ b 0 , Δ b 1 , Δ b 2 ,
where the differences (2) form the columns of the 3 × 3 matrix D . Equivalently, rank D < 3 . This condition is met by all the 3D cubics with self-intersection that Yu et al. [13] plot in their Figure 5d–f, whose control points are not generated at random as claimed but chosen to lie on a plane.
The condition rank D = 1 (for either a 2D or 3D curve) means that all points are aligned and b ( t ) , hence, degenerates to a straight line, the only improperly parametrized cubic [26]. A non-overlapping parametrization of this line ([13], Theorem 1) amounts to the injectivity of a cubic function, a property easy to test [27]. From now on, we exclude the degenerate geometry of a straight line.

4. Finding the Parameter Values for the Double Point via Factorization

In the preceding section, we concluded that only plane cubics admit a self-intersection S . Next, we focus on such curves, revisit the factorization algorithm [19,20] for finding the parameter values u , v (1), and employ it to derive the formulas by Wang [16] (power basis) and Su and Liu [17] (the Bernstein basis), showing their equivalence.
Given a polynomial curve b ( t ) of arbitrary degree, both components of the bivariate difference b ( u ) b ( v ) contain the common factor u v [28]. We can, thus, remove the trivial solution u = v to obtain what Farouki [12] calls reduced difference:
d ( u , v ) = b ( u ) b ( v ) u v .
If b ( t ) is written in the power basis
b ( t ) = k = 0 3 a k t k , a k = x k y k ,
then d ( u , v ) (4) admits a simple expression involving only the coefficients a 1 , a 2 , a 3
d ( u , v ) = a 1 + β a 2 + γ a 3 , β = u + v γ = ( u + v ) 2 u v .
If b ( t ) , t [ 0 , 1 ] is given in Bernstein–Bézier form, we compute such coefficients as linear combinations of forward differences (2) as follows:
a 1 a 2 a 3 = 3 0 0 3 3 0 1 2 1 Δ b 0 Δ b 1 Δ b 2 .
Setting d ( u , v ) = 0 , the values β , γ (6) come as solutions of a system of linear equations. In matrix form and writing the power coefficients a k as column vectors (5), the following expression is obtained:
a 1 + A 1 β γ = 0 , A 1 = a 2 , a 3 .
This system admits infinite solutions if rank A = 1 , where A = a 1 , a 2 , a 3 . However, using (7), rank A = rank D , where D is the matrix (3). Therefore, rank A = 1 implies a straight line, a degenerate case ruled out in Section 2. If rank A 1 = 2 , Cramer’s rule furnishes the unique solution as a quotient of determinants A i as follows:
{ β , γ } = { A 2 , A 3 } / A 1 , A i = | A i | ,
where the 2 × 2 square matrix A i is obtained by dropping a i in A . Finally, using Viete’s formulas, the sought values u , v are the roots of the quadratic polynomial t 2 ( u + v ) t + u v . In terms of β , γ (6), we reach the formula by Wang [16]
{ u , v } = 1 2 β ± 4 γ 3 β 2 ,
or the particularized expressions for the special coordinate systems in [19,20]. Equivalently
{ u , v } = A 2 ± d 2 A 1 , d = 4 A 3 A 1 3 A 2 2 .
We can employ relationship (7) to rewrite the determinants A i (9) as follows:
A 1 A 2 A 3 = 3 1 1 1 0 1 2 0 0 3 D 0 D 1 D 2 , D i = | D i | ,
where D i is similarly obtained by dropping Δ b i into D . Substitution into (10) generates the alternative expression in Bernstein form derived by Su and Liu [17]:
{ u , v } = 2 D 2 D 1 ± 3 δ 2 ( D 0 D 1 + D 2 ) , δ = 4 D 0 D 2 D 1 2 = d / 27
Degen [18] rewrites this expression in terms of the pair { ρ , σ } = { D 0 , D 2 } / D 1 of affine invariants such that Δ b 1 = ρ Δ b 0 + σ Δ b 2 , which implies that { u , v } are also affine invariants. It must be warned that this formula blows up when D 1 = 0 , i.e., when the end control legs are parallel.

5. Conditions for the Existence of a Self-Intersection

The equivalent Formulas (10) and (12) for { u , v } yield the self-intersection (1) only if the following three conditions are met:
(i)
A 1 = | A 1 | 0 , tantamount to D 0 D 1 + D 2 0 : The formulas are well defined;
(ii)
Discriminant d > 0 , tantamount to δ > 0 : The values { u , v } are distinct and real;
(iii)
u , v [ 0 , 1 ] , when considering the Bézier segments.
Su and Liu [17] spell out the above necessary and sufficient conditions as a set of inequalities in terms of the determinants D i (11). Condition (i) corresponds to that described in Remark 2 (2D case) by Yu et al. [13]. In previous works [16,20], although A 1 appears to be a denominator, the possibility that it vanished is not considered.
Next, we geometrically interpret what happens when algebraic conditios (i) or (ii) is not met. First, we must answer a fundamental question: how many essentially different planar cubics are there? Let us consider cubics b ( t ) in untrimmed form, with t ( , ) , and only true cubics, hence ruling out not only straight lines but also parabolas. Based on the previous work by Wang [16], Stone and DeRose [9] answer this question. Pottmann [29] and Koprowski [30] show how the results in [9] relate to the classical theories of line and algebraic geometry, respectively. Untrimmed cubics are classified into four affine types according to their respective shapes. Formally speaking, we define four equivalence classes (Figure 2), whereby two cubics are equivalent if related by an affine map:
(a)
Crunodal (loop-shaped): One self-intersection S (called crunode) and no inflections;
(b)
Cuspidal: One cusp C but neither inflection nor self-intersections;
(c)
Acnodal (hump-shaped): One acnode and two inflections but no self-intersections;
(d)
S-shaped: One inflection I but no self-intersections.
Each class is generated by its respective canonical representative [31]: (a) the Tschirnhausen cubic [32]; (b) semi-cubical parabola [32]; (c) acnodal cubic; (d) graph of the cubic function y = x 3 . We conclude that cubics with self-intersections are simply crunodal cubics, i.e., affine versions of the Tschirnhausen cubic. When either condition (i) or (ii) is not fulfilled, we come across other curve classes. Indeed, depending on the circumstances, on of the following points is true:
(i)
If A 1 = 0 , then the second derivative b ( t ) = 2 a 2 + 6 a 3 t is either a line through the origin, which implies the inflection I of type (d), or degenerates to point 2 a 2 , which means not a true cubic but a line or a parabola.
(ii)
A discriminant d = 0 indicates a cusp (b), the limiting case u = v of a self-intersection where two consecutive points coincide [33], whereas d < 0 implies complex values u , v C and, hence, an acnodal cubic (c). In [9,19,21,22,25], a similar analysis characterizes the double point.
Finally, recall that the visual inspection of the Bézier polygon does not directly reveal the existence of a self-intersection S . However, Vincent [34] identifies a necessary (but not sufficient) condition on the polygon. He categorizes cubic polygons according to the signed areas of the triangles formed by triples of control points, proving that the existence of S is possible only for the two types of polygons illustrated in Figure 3: self-intersecting or concave (but not zig-zag or convex). Yu et al. [13] call such polygons ill posed, adhering to the terminology introduced by Zhu and Zhao [35]. For rational Bézier cubics with positive weights, Chionh and Sederberg [24] derive the same configuration as a necessary condition for self-intersection. This geometry is more restrictive and, hence, encompasses the angle criterion by Lasser [11] for curves of arbitrary degree, stating that a self-intersection implies | α k | > π , where α k denotes the exterior angles of the Bézier polygon.

6. Conclusions

Integral cubic curves admit a self-intersection S only in the planar case, so there is no need to address the problem in a 3D setting. Simple explicit formulas are well known for computing the parameter values at the potential self-intersection of a non-degenerate plane cubic (different from a straight line). Such values are affine invariants depending on the curve hodograph and come as the roots of a quadratic equation. If the cubic is given in power basis, employ expression (10) to obtain the parameter values { u , v } for S . In the Bernstein basis, firstly, compute the forward differences (2), from them compute the power coefficients (7), and finally { u , v } (10), directly apply the equivalent Formula (12).
Formulas (10) and (12) yield a self-intersection only if three algebraic conditions, (i), (ii), and (iii), straightforward to check either in the power or Bernstein basis, are met. When (i) or (ii) are not fulfilled, we come across a cubic not of the crunodal type.

Funding

Supported by grant PID2022-137598NB-I00 funded by MCIU/AEI/10.13039/501100011033 and FEDER/EU.

Data Availability Statement

No new data were created or analyzed in this study.

Conflicts of Interest

The author declares no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
CAGDComputer Aided Geometric Design
CNCComputer Numerical Control

References

  1. Farin, G. Curves and Surfaces for Computer Aided Geometric Design, 5th ed.; Morgan Kaufmann: San Francisco, CA, USA, 2001. [Google Scholar]
  2. Hoschek, J.; Lasser, D. Fundamentals of Computer Aided Geometric Design; AK Peters: Wellesley, MA, USA, 1993. [Google Scholar]
  3. Holmer, F. The Beauty of Bézier Curves. Available online: https://www.youtube.com/watch?v=aVwxzDHniEw (accessed on 6 August 2024).
  4. Adobe Systems. PostScript Language Tutorial and Cookbook; Addison-Wesley: Reading, MA, USA, 1985. [Google Scholar]
  5. Eisenberg, J.; Bellamy-Royds, A. SVG Essentials: Producing Scalable Vector Graphics with XML, 2nd ed.; O’Reilly: Sebastopol, CA, USA, 2014. [Google Scholar]
  6. Marlin. G5-Bézier Cubic Spline. Available online: https://marlinfw.org/docs/gcode/G005.html (accessed on 6 August 2024).
  7. Barnhill, R. E Geometry Processing for Design and Manufacturing; SIAM, Society for Industrial and Applied Mathematics: Philadelphia, PA, USA, 1992. [Google Scholar]
  8. Elber, G.; Lee, I.-K.; Kim, M.-S. Comparing curve approximation methods. IEEE Comput. Graph. Appl. 1997, 17, 62–71. [Google Scholar] [CrossRef]
  9. Stone, V.; DeRose, T.D. A geometric characterization of parametric cubic Curves. ACM Trans. Graph. 1989, 8, 147–163. [Google Scholar] [CrossRef]
  10. Sánchez-Reyes, J.; Fernández-Jambrina, L. On the reach and the smoothness class of pipes and offsets: A survey. AIMS Math. 2022, 7, 7742–7758. [Google Scholar] [CrossRef]
  11. Lasser, D. Calculating the self-intersections of Bézier curves. Comput. Ind. 1989, 12, 259–268. [Google Scholar] [CrossRef]
  12. Farouki, R.T. Reduced difference polynomials and self-intersection computations. Appl. Math. Comput. 2018, 324, 174–190. [Google Scholar] [CrossRef]
  13. Yu, Y.-Y.; Li, X.; Ji, Y. On Self-intersections of Cubic Bézier Curves. Mathematics 2024, 12, 882. [Google Scholar] [CrossRef]
  14. Patrikalakis, N.M.; Maekawa, T. Shape Interrogation for Computer Aided Design and Manufacturing; Springer: Berlin/Heidelberg, Germany, 2002. [Google Scholar]
  15. Maekawa, T.; Cho, W.; Patrikalakis, N.M. Computation of self-intersections of offsets of Bézier patches. J. Mech. Des. 1997, 119, 275–283. [Google Scholar] [CrossRef]
  16. Wang, C.Y. Shape classification of the parametric cubic curve and parametric B-spline cubic curve. Comput.-Aided Des. 1981, 13, 199–206. [Google Scholar] [CrossRef]
  17. Su, B.Q.; Liu, D.Y. An affine invariant and its application in computational geometry. Sci. Sin. (Ser. A) 1983, 24, 256–267. [Google Scholar]
  18. Degen, W. Some remarks on Bézier curves. Comput. Aided Geom. Des. 1988, 5, 259–268. [Google Scholar] [CrossRef]
  19. Thompson, S. On the Classification of Parametric Cubic Curves. Res. J. Math. Technol. 2013, 119, 195. [Google Scholar]
  20. StackExchange. 2D Cubic Bezier Curve. Point of Self-Intersection. Available online: https://math.stackexchange.com/questions/3776840/2d-cubic-bezier-curve-point-of-self-intersection (accessed on 6 August 2024).
  21. Patterson, R.R. Parametric curves as algebraic curves. Comput. Aided Geom. Des. 1988, 5, 139–159. [Google Scholar] [CrossRef]
  22. Fiorot, J.-C.; Jeannin, P.; Taleb, S. Rational cubic curves as BR-curves. Comput. Aided Geom. Des. 1995, 12, 67–88. [Google Scholar] [CrossRef]
  23. Loop, C.; Blinn, J. Resolution independent curve rendering using programmable graphics hardware. ACM Trans. Graph. 2005, 24, 1000–1009. [Google Scholar] [CrossRef]
  24. Chionh, E.-W.; Sederberg, T.W. On the minors of the implicitization Bézout matrix for a rational plane curve. Comput. Aided Geom. Des. 2001, 18, 21–36. [Google Scholar] [CrossRef]
  25. Barrowclough, O.J.D. A basis for the implicit representation of planar rational cubic Bézier curves. Comput. Aided Geom. Des. 2014, 31, 148–167. [Google Scholar] [CrossRef]
  26. Sederberg, T.W. Improperly parametrized rational curves. Comput. Aided Geom. Des. 1986, 3, 67–75. [Google Scholar] [CrossRef]
  27. StackExchange. How Can You Quickly Tell If a Cubic Polynomial Gives an Injective Function? Available online: https://math.stackexchange.com/questions/2027560/how-can-you-quickly-tell-if-a-cubic-polynomial-gives-an-injective-function (accessed on 6 August 2024).
  28. Pekerman, D.; Elber, G.; Kim, M.S. Self-intersection detection and elimination in freeform curves and surfaces. Comput. Aided Des. 2008, 40, 140–159. [Google Scholar] [CrossRef]
  29. Pottmann, H. Studying NURBS curves and surfaces with classical geometry. In Mathematical Methods for Curves and Surfaces; Daehlen, M., Lyche, T., Schumaker, L., Eds.; Vanderbilt University Press: Nashville, TN, USA, 1995; pp. 413–438. [Google Scholar]
  30. Koprowski, P. Algebraic Approach to a Geometric Characterization of Parametric Cubics. J. Geom. Graph. 2007, 2, 173–178. [Google Scholar]
  31. Saito, T.; Yamada, M.; Yoshida, N. Shape analysis of cubic Bézier curves––Correspondence to four primitive cubics. Comput. Aided Des. Appl. 2014, 11, 568–578. [Google Scholar] [CrossRef]
  32. Lawrence, J.D. A Catalog of Special Plane Curves; Dover: New York, NY, USA, 1972. [Google Scholar]
  33. Peterson, O.J. The double points of rational curves. Amer. Math. Mon. 1917, 24, 376–379. [Google Scholar] [CrossRef]
  34. Vincent, V. Fast detection of the geometric form of two-dimensional cubic Bézier curves. J. Graph. Tools 2002, 7, 43–51. [Google Scholar] [CrossRef]
  35. Zhu, C.-G.; Zhao, X.-Y. Self-intersections of rational Bézier curves. Graph. Model. 2014, 76, 312–320. [Google Scholar] [CrossRef]
Figure 1. Any cubic with a self-intersection lies on the plane Π containing the triangular Bézier polygon defining the loop.
Figure 1. Any cubic with a self-intersection lies on the plane Π containing the triangular Bézier polygon defining the loop.
Mathematics 12 02463 g001
Figure 2. The four affine types of integral cubics are as follows: (a) crunodal; (b) cuspidal; (c) acnodal; (d) S-shaped.
Figure 2. The four affine types of integral cubics are as follows: (a) crunodal; (b) cuspidal; (c) acnodal; (d) S-shaped.
Mathematics 12 02463 g002
Figure 3. There are only two types of Bézier polygons associated with a cubic that may display a self-intersection S : (I) self-intersecting; (II) concave.
Figure 3. There are only two types of Bézier polygons associated with a cubic that may display a self-intersection S : (I) self-intersecting; (II) concave.
Mathematics 12 02463 g003
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Sánchez-Reyes, J. Self-Intersections of Cubic Bézier Curves Revisited. Mathematics 2024, 12, 2463. https://doi.org/10.3390/math12162463

AMA Style

Sánchez-Reyes J. Self-Intersections of Cubic Bézier Curves Revisited. Mathematics. 2024; 12(16):2463. https://doi.org/10.3390/math12162463

Chicago/Turabian Style

Sánchez-Reyes, Javier. 2024. "Self-Intersections of Cubic Bézier Curves Revisited" Mathematics 12, no. 16: 2463. https://doi.org/10.3390/math12162463

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop