On Self-Intersections of Cubic Bézier Curves

: Cubic Bézier curves are widely used in computer graphics and geometric modeling, favored for their intuitive design and ease of implementation. However, self-intersections within these curves can pose significant challenges in both geometric modeling and analysis. This paper presents a comprehensive approach to detecting and computing self-intersections of cubic Bézier curves. We introduce an efficient algorithm that leverages both the geometric properties of Bézier curves and numerical methods to accurately identify intersection points. The self-intersection problem of cubic Bézier curves is firstly transformed into a quadratic problem by eliminating trivial solutions. Subsequently, this quadratic system is converted into a linear system that may be easily analyzed and solved. Finally, the parameter values corresponding to the self-intersection points are computed through the solution of the linear system. The proposed method is designed to be robust and computationally efficient, making it suitable for real-time applications.


Introduction
The representation of free-form curves and surfaces is a foundational research topic within Computer-Aided Geometric Design (CAGD) and computer graphics (CG), as well as various related fields [1].Bézier curves and surfaces, constructed through control points and Bernstein basis functions, represent one of the most pivotal methodologies in this domain.Owing to the intrinsic properties of Bernstein basis functions, Bézier entities exhibit several advantageous characteristics, such as affine invariance, the convex hull property, and endpoint interpolation.The manipulation of control points allows for nuanced and intuitive shape control of Bézier curves and surfaces, facilitating their widespread application.
The identification of self-intersections in free-form curves and surfaces is a critical requirement across various Computer-Aided Design (CAD) and Computer-Aided Manufacturing (CAM) applications, such as NC machining and robotic navigation [2].For example, during the process of image deformation, self-intersection in the parameterization can cause image overlapping, distortion, and loss of information.In addition, surfaces with self-intersecting cross-section curves are difficult to manufacture directly using CNC machines in the field of mechanical engineering.Recognizing this, Hoffman has highlighted the self-intersection computation of parametric curves and surfaces as one of the most fundamental issues in geometric and solid modeling [3,4].
Given the importance of this issue, numerous researchers have dedicated their efforts to identifying and efficiently calculating self-intersection points in free-form curves and surfaces.Techniques such as light and shadow tracing have been employed to compute these self-intersections, though they may not always yield accurate results.Barnhill et al. [5] introduced a marching method that initially identifies potential intersection branches, a process that, however, is susceptible to generating phantom branches and thus may produce erroneous outcomes.Su and Liu [6] explored curve singularities (self-intersections, cusps) and inflection points using the affine-invariant method (AIM), revealing that the characteristic points of a curve align with its characteristic distribution graph in the presence of self-intersections.Building on this concept, Ye [7] developed a simpler method to map the distribution of singularities and inflection points, enabling the identification of characteristic point regions in planar cubic Bézier curves without resorting to solving equations.This methodology has inspired subsequent studies on the distribution of singularities in specific curve types, such as C-Bézier and F-Bézier curves [8][9][10][11].Lasser [12] introduced a curvecurve method that evaluates the cumulative rotation angle of the tangent vector to detect and calculate self-intersections in Bézier curves.However, the lack of a theoretical proof within this method may affect the reliability of its predictions in some scenarios.Further advancements by Zhu and Zhao [13,14] provided sufficient and necessary conditions for rational Bézier curves and surfaces to be self-intersection-free, employing toric degeneration theory and well-posedness conditions.Yet the stringent bijectivity conditions set forth in these studies are often too restrictive, leading to inaccuracies when determining the bijectivity of Bézier curves in practical situations.Yu et al. [15,16] introduced algorithms to assess self-intersections in toric surfaces and volumes, applicable to Bézier geometries.For more information on self-intersection studies in curves and surfaces, interested readers can refer to [17][18][19].
In practical scenarios, quadratic and cubic Bézier curves are favored for their robust capability in geometric representation, along with their cost-effective computational costs and numerical stability, as compared to their higher-degree counterparts.Yet the current algorithms for identifying self-intersections do not cater specifically to cubic Bézier curves, which leads to computational inefficiencies in these instances.Furthermore, the bijectivity conditions proposed in [12,13] may prove overly stringent for a range of practical applications.
This paper proposes a simple yet effective method for computing all self-intersections of cubic Bézier curves.Drawing on the algebraic decomposition approach as discussed in [20,21], the self-intersection problem of cubic Bézier curves can be firstly transformed into a quadratic problem by eliminating the trivial solutions.Subsequently, this quadratic system is converted into a linear system that may be easily analysed and solved.Finally, the parameter values corresponding to the self-intersection points are obtained through the solution of the aforementioned linear system.The proposed methodology offers an efficient and precise computation of all self-intersections within cubic Bézier curves, overcoming the limitations of the existing algorithms as noted in [12,13].
The remainder of this paper is structured as follows.Section 2 details the methodology for computing self-intersections in cubic Bézier curves.Section 3 showcases numerical experiments to demonstrate the effectiveness and efficiency of the proposed method.Finally, Section 4 summarizes our findings and contributions.

Methodology
In this section, we discuss both the existence and the fast computation of self-intersections in cubic Bézier curves.Section 2.1 provides a brief introduction to cubic Bernstein basis functions and cubic Bézier curves.Section 2.2 discusses the scenario where the four control points of the cubic Bézier curve are collinear, while Section 2.3 covers the case in which they are not collinear.

Cubic Bernstein Basis Functions and Bézier Curves
Bernstein basis functions are polynomials that have a partition of unity and are nonnegative over the interval [0, 1].Bernstein basis functions of degree n are expressed as for i = 0, 1, . . ., n.The Bernstein basis functions (1) form the mathematical foundation of Bézier curves, a class of parametric curves extensively used in computer graphics, animation, and CAD systems due to their intuitive design and easy computation.A cubic Bézier curve is defined as a linear combination of four control points P i = (x i , y i , z i ) T ∈ R 3 (i = 0, 1, 2, 3), with the degree-3 Bernstein basis functions as coefficients.Then, a cubic Bézier curve is defined as the image of the following vector-valued parametric function [1] Figure 1b illustrates a cubic Bézier curve.Due to the specific properties of Bernstein polynomials, such as the fact that the sum of their values at any given ξ is always one, the resulting Bézier curve exhibits strong stability and predictable behavior, making it a preferred tool for curve design.The partition of unity and non-negativity property of Bernstein basis functions ensures that the curve lies within the convex hull of its control points P i (i = 0, 1, 2, 3).In addition, Bézier curves possess the affine invariance property, meaning that their shape is preserved under affine transformations, providing a useful property for various geometric modeling applications and computations.
Self-intersections in cubic Bézier curves are of significant interest due to their implications in design and rendering processes.A cubic Bézier curve may intersect itself depending on the geometric configuration of its control points when there are distinct parameters ξ 1 and ξ 2 such that C(ξ 1 ) = C(ξ 2 ). Figure 2a shows a cubic Bézier curve that is free of self-intersections, while Figure 2b presents a cubic Bézier curve that intersects itself due to the placement of specific control points.Both serve as examples for understanding the geometric implications of control point configurations in curve design.

Cubic Bézier Curves with Collinear Control Points
Consider the four control points {P i } 3 i=0 of a cubic Bézier curve C(ξ) to be collinear, i.e., satisfying − − → P 0 P j = k j −−→ P 0 P 3 (j = 1, 2).Thanks to the affine invariance property of Bézier curves, its shape remains unaltered by translation and rotation transformations.Therefore, we apply Rodrigues' rotation formula to translate and rotate the control points {P i } 3 i=0 to { P i } 3 i=0 , positioning P 0 at the origin (0, 0, 0) T and aligning P 3 along the positive x-axis at a distance x 3 = (x 3 − x 0 ) 2 + (y 3 − y 0 ) 2 + (z 3 − z 0 ) 2 , i.e., P 3 = ( x 3 , 0, 0) T .This adjustment sets the x-coordinate of { P j } j=1,2 to k j x 3 .Under these transformations, the cubic Bézier curve C(ξ), redefined by the control points { P i } 3 i=0 , simplifies to a linear trajectory along the x-axis, and can be expressed as To analyze the trend of the cubic Bézier curve C(ξ), we examine its derivative as derived from Equation (3) The monotonicity of C(ξ) hinges on the solvability of its derivative function C ′ (ξ).
Concurrently, the presence of solutions for the derivative function, as defined in Equation ( 4), is contingent upon the value of its discriminant . ( Based on the calculations in ( 3)-( 5), we are now prepared to articulate the following theorem.
Theorem 1.Consider the set of control points {P i } 3 i=0 lying on a straight line, fulfilling the condition − − → Proof.Upon applying translation and rotation to the curve C(ξ) as defined in Equation (3), a condition arises where to a consistently positive discriminant in Equation (5).Under these circumstances, the quadratic derivative function C ′ (ξ) in Equation ( 4) possesses two distinct roots, indicating a change in the monotonicity of the cubic function C(ξ) at these roots.Given that the control points are aligned collinearly, the cubic Bézier curve C(ξ) is constrained to the line defined by these points and maintains continuity.A change in monotonicity thus signifies self-overlapping within the curve.In contrast, the absence of such a change denotes a monotonic C(ξ) devoid of self-intersections.
According to the affine invariance property of Bézier curves, it follows that C(ξ) retains the identical geometric relationships as C(ξ).
Theorem 1 serves as a pivotal tool for identifying the presence of a self-intersection, or more precisely, a self-overlap in cubic Bézier curves when their control points are aligned collinearly.In the following subsection, our discussion will expand into scenarios where cubic Bézier curves exhibit non-collinear control points.

Cubic Bézier Curves with Non-Collinear Control Points
Consider the four non-collinear control points P i = (x i , y i , z i ) T , for i = 0, 1, 2, 3, of a cubic Bézier curve C(ξ).The problem of identifying self-intersections within this curve boils down to determining the parameters ξ 1 and ξ 2 such that ξ 1 ̸ = ξ 2 while simultaneously ensuring C(ξ 1 ) = C(ξ 2 ).From the definition in Equation (2), that is, To streamline our analysis, similarly, we reposition the control points {P i } 3 i=0 to { P i } 3 i=0 , where P i = ( x i , y i , z i ) T and set P 0 as the origin.The resulting cubic Bézier curve, represented by the control points { P i } 3 i=0 and denoted as C(ξ), retains identical geometric properties to C(ξ).
Substituting the control points { P i } 3 i=0 and the cubic Bernstein basis functions {B 3 i } 3 i=0 into Equation ( 6), we have To discuss the solutions of the system (7), we first organize the cubic Bernstein basis {B 3 i } 3 i=0 as follows: For a polynomial parametric curve, denoted as L(ξ), the equation characterizing self-intersections, originally expressed as L(ξ 1 ) − L(ξ 2 ) = 0, can be transformed into (ξ 1 − ξ 2 ) L(ξ 1 , ξ 2 ) = 0.It allows for the exclusion of the trivial solution ξ 1 = ξ 2 , thereby simplifying the process and focusing on non-trivial intersections, which is also referred to as the algebraic decomposition approach.By employing this strategy, we denote Equation ( 8) is substituted into Equation ( 7) and the non-zero common factor ξ 2 − ξ 1 is eliminated.Then, the system of cubic equations in Equation ( 7) can be equivalently expressed as the following linear system Now, the task at hand is to solve the linear system (9) to effectively determine the self-intersections of cubic Bézier curves. Denote and Equation (9) are abbreviated as where A is the coefficient matrix, and (A, B) denotes its augmented matrix.
To elucidate the resolution of the linear system in Equation ( 10), we introduce the following lemma: Lemma 1.Consider a set of four non-collinear control points { P i } 3 i=0 of a cubic Bézier curve.The rank of the augmented matrix (A, B) is determined to be either 2 or 3. A, B)) = 0 if and only if all control points are the same, which falls into the collinear case in Section 2.2.Therefore, rank((A, B)) ̸ = 0 holds.Utilizing elementary matrix transformations, we can deduce that

Proof. First of all, rank((
It is evident that the rank of the augmented matrix (A, B) cannot exceed 3.If rank((A, B)) < 2, it effectively implies that rank((A, B)) = 1.Consequently, there must be two non-zero constants, l 1 and l 2 , leading to the matrix transformation: which would imply collinearity among the control points P i = ( x i , y i , z i ), contradicting their non-collinearity.Therefore, we draw the conclusion that rank((A, B)) = 2 or 3.
Lemma 1 offers a thorough analysis of the rank of the augmented matrix (A, B), providing a theoretical basis for the subsequent discussion.According to the foundational principles of linear algebra, we may readily classify the solutions to the binary linear equations system as delineated in Equation ( 10) by classifying the rank of the coefficient matrix A and the augmented matrix (A, B).Consequently, we present the following theorem without the need for further proof.Theorem 2. For the four non-collinear control points { P i } 3 i=0 defining a cubic Bézier curve, the resolution of Equation ( 10) can be classified as (1) If rank(A) < rank((A, B)), then Equation (10) has no solution, implying the cubic Bézier curve C(ξ) does not exhibit self-intersections; (2) If rank(A) = rank((A, B)) = 2, then Equation ( 10) has a unique solution m 1 = m 1 and m 2 = m 2 ; (3) When rank(A) = rank((A, B)) < 2, an infinite number of solutions is theoretically possible.Nevertheless, Lemma 1 negates the feasibility of this case.

Remark 1.
A similar analysis method can be applied to compute the self-intersections of quadratic Bézier curves.It is easy to know that when the three control points of a quadratic Bézier curve are non-collinear, there is no self-intersection.
In the context of case (2) outlined in Theorem 2, determining the self-intersection points of the cubic Bézier curve C(ξ) necessitates solving a set of binary quadratic equations: From the second equation in Equation (11), it can be deduced that ξ 2 = m 2 − ξ 1 .Substituting this into the first equation yields a quadratic equation: solvable using the quadratic formula.For ∆ = 4 m 1 − 3 m 2 2 ≥ 0, the roots are given by Given the symmetry between ξ 1 and ξ 2 in Equation ( 11), ξ 1,1 and ξ 1,2 represent the solutions.If both ξ 1,1 and ξ 1,2 fall within the interval [0, 1], then C(ξ 1,1 ) = C(ξ 1,2 ) indicates a self-intersection point of the cubic Bézier curve C(ξ).In the absence of such conditions, the curve C(ξ) does not self-intersect.This rationale equally pertains to the curve C(ξ).
Remark 2. The analysis of planar cubic Bézier curves presents a more streamlined scenario.To find the solution, it suffices to address only the initial two equations from Equation (9).A unique solution exists if and only if the condition rank(A * ) = rank((A * , B * )) = 2 is met, with A * and B * representing the matrices formed from the first two rows of A and B, respectively.
Following the above discussion, we introduce the following algorithm (Algorithm 1) specifically formulated to compute self-intersections in cubic Bézier curves.The accuracy of the obtained results can be verified by substituting them back into the expression for the cubic Bézier curve.In fact, Algorithm 1 is known to accurately identify all self-intersections of the cubic Bézier curve, according to the basic principles of linear algebra.

Numerical Experiments
This section details numerical experiments conducted to evaluate the performance and efficiency of the proposed algorithm across both two-dimensional (2D) and threedimensional (3D) cubic Bézier curves.The experiments were executed using Matlab 2023a on a system equipped with a 2.10 GHz, 12th Generation Intel(R) Core(TM) i7-1260P processor and 16 GB of RAM.Example 1. Figure 3 presents a collection of cubic Bézier curves, each defined by randomly generated control points.The first row displays two-dimensional curves, while the second row shows three-dimensional curves.As determined by Algorithm 1, these cubic Bézier curves exhibit no self-intersections.The computation time associated with each curve, as denoted next to their respective image identifiers, underscores the high computational efficiency of the proposed method.In [12], Lasser introduced a condition for bijectivity: the sum of rotation angles for a Bézier curve's tangent vector must be less than π. Figure 4a demonstrates a case where |α 1 | + |α 2 | > π, suggesting a violation of this condition and potential self-intersection.However, this particular cubic Bézier curve does not exhibit any self-intersections, as shown in Figure 3b.Furthermore, according to the established bijectivity conditions and well-posedness definitions in [13], the control polygons depicted in Figure 3b is identified as non-well-posed cases because the segment P 2 P 3 passes through the triangle formed by P 0 , P 1 , and P 2 , as shown in Figure 4b, which are inherently intractable using the established method.Contrary to these limitations, our proposed Algorithm 1 adeptly circumvents these constraints, accurately confirming that these contentious cases are devoid of self-intersections.This suggests that our proposed method not only directly addresses the shortcomings of previous techniques but also significantly advances the computational determination of self-intersecting Bézier curves with robustness.Example 2. Figure 5 shows a series of cubic Bézier curves, each defined by control points generated at random.Through the application of Algorithm 1, we calculate the parameter values corresponding to the self-intersections within these curves, alongside the required computation time.For enhanced clarity, zoomed-in views of the intersection regions are provided within each figure.Table 1 presents the comprehensive computation results from this example.
Example 3. In this example, control points for 10 4 instances of both two-dimensional and threedimensional cubic Bézier curves were generated randomly.The application of Algorithm 1 revealed that, in the 2D context, 87.22% of these curves were devoid of self-intersections, whereas the remaining 12.78% exhibited such intersections.Conversely, within the 3D domain, 41.11% of the curves lacked self-intersections, with 58.89% presenting them.Figure 6 delineates the average computation times involved in identifying or calculating self-intersections across all cubic Bézier curves, as well as those specifically with and without self-intersections.
The discrepancy in the computation time between 3D and 2D analyses, as shown in Figure 6, stems from the underlying complexity of solving the cubic Bézier curve equations.For curves without self-intersections, the determination is straightforward through the rank assessment of the augmented matrix, bypassing the need for solving linear systems entirely.In contrast, selfintersecting scenarios require solving a set of three equations in 3D, compared to just two in 2D.This distinction naturally leads to a variance in computational effort and, consequently, computation time, which is more pronounced in 3D analyses.Nonetheless, it is crucial to highlight that our proposed method maintains high efficiency in both dimensions.

Conclusions
In this paper, we systematically investigate the computation of all self-intersections of cubic Bézier curves.For collinear control points of a cubic Bézier curve, its geometric properties and the monotonicity condition of cubic functions are employed to establish a positional relationship that predicts self-intersections.In cases of non-collinear control points, we check the variations of the same Bernstein basis function at different parameter values, simplifying the intersection problem from cubic to quadratic by eliminating the trivial solution.The resultant quadratic system is then converted into a linear system through variable substitution.By integrating linear algebraic principles and the quadratic formula, we develop a robust and efficient algorithm to compute all self-intersection points on a cubic Bézier curve.The proposed algorithm is easy to comprehend and implement.Moreover, it distinctly outperforms existing methodologies by rapidly calculating all selfintersection points on cubic Bézier curves with enhanced speed and accuracy.

Figure 1 .
Figure 1.Cubic Bernstein basis functions and a cubic Bézier curve.

Figure 2 .
Figure 2. Comparison of cubic Bézier curves with and without self-intersection.

Figure 5 .
Figure 5. Two-dimensional (in the first row, a-c) and three-dimensional (in the second row, d-f) cubic Bézier curves demonstrating self-intersection.

Figure 6 .
Figure 6.Histogram illustrating the average computation times for detecting self-intersections in 2D and 3D cubic Bézier curves.

Table 1 .
Computation results from Example 2.