 Original Article
 Open Access
 Published:
Curve intersection based on cubic hybrid clipping
Visual Computing for Industry, Biomedicine, and Art volume 5, Article number: 17 (2022)
Abstract
This study presents a novel approach to computing all intersections between two Bézier curves using cubic hybrid clipping. Each intersection is represented by two strip intervals that contain an intersection. In each step, one curve is bounded by two fat lines, and the other is bounded by two cubic Bézier curves, clipping away the domain that does not contain the intersections. By selecting the moving control points of the cubic hybrid curves, better cubic polynomial bounds are obtained to make the proposed method more efficient. It was proved that the two strip intervals have second and fourthorder convergence rates for transversal intersections. Experimental results show that the new algorithm is the most efficient among all existing curve/curve intersection approaches.
Introduction
Given an interval [α, β] ⊂ ℝ, a Bézier curve P(t), t ∈ [α, β] is defined as
where \({B}_{i,\left[\alpha, \beta \right]}^n(t)=\left(\genfrac{}{}{0pt}{}{n}{i}\right)\frac{{\left(t\alpha \right)}^i{\left(\beta t\right)}^{ni}}{{\left(\beta \alpha \right)}^n},i=0,1,\dots, n\) are Bernstein polynomials in [α, β], and \({\left\{{\mathbf{P}}_i\right\}}_{i=0}^n\) are the control points [1]. Given two Bézier curves P(t), t ∈ [α, β] and Q(s), s ∈ [ξ, η], the problem considered in the present study is how to compute all (t^{∗}, s^{∗}), t^{∗} ∈ [α, β], s^{∗} ∈ [ξ, η] such that P(t^{∗}) = Q(s^{∗}). Various methods have been developed to solve this task, such as a subdivisionbased approach [2], binary subdivision approach [3], implicitization [4] and Bézier clipping [5].
The most common approach consists of clipping away the regions of the curves that are guaranteed to not intersect. Each intersection parameter pair (s^{∗}, t^{∗}) is replaced with an interval that is iteratively computed. The kth iteration interval is denoted as [α_{k}, β_{k}] × [ξ_{k}, η_{k}]. Let h_{k} = β_{k} − α_{k} and d_{k} = η_{k} − ξ_{k}. If a constant γ_{i} exists such that
where C_{i} are constants independent of k and the curves, and thus γ_{i} is the convergence rate of the sequence intervals {[α_{k}, β_{k}]}_{k} and {[ξ_{k}, η_{k}]}_{k}. The key problem is to find an algorithm for which γ_{i} is as large as possible with as few computations as possible during each iteration.
The above problem plays an important role in many engineering fields, such as computeraided design and manufacturing (CAD/CAM), collision detection, and geometric modeling [1], and is a basic operation in solid modeling. In geometric processing, the intersections and intersection curves in a solid model are extremely important for the visualization, analysis, and manufacturing of the model [6]. With the continuous development of computeraided geometric design and CAD/CAM, as well as the continuous progress made in science and technology, the numbers of calculations and data to be processed for intersection problems are increasing. It is therefore important to develop efficient and stable methods for dealing with intersection problems.
To solve such problems, the Bézier clipping algorithm introduced in ref. [5] is a widely used, fast, and robust method. The Bézier clipping algorithm was proven to have a secondorder convergence rate [7]. Subsequently, several different approaches have been proposed to improve the Bézier clipping algorithm. Bartoň and Jüttler [8] and Liu et al. [9] developed quadratic and cubic clipping techniques based on a degree reduction to compute all roots of a univariate polynomial equation. Lou and Liu [10] extended the approach in ref. [9] to curve/curve intersection problems and proved that the algorithm achieves at least a secondorder convergence rate. In addition, North [11] developed a geometry interval clipping algorithm based on quadratic hybrid curves [12] for use with curve/curve intersection problems, Liu and Li [13] proved that the algorithm achieves a quadratic convergence rate. Moreover, Yuan [14] recently developed a cubic hybrid clipping (HybClip) based on hybrid curves to compute all roots of a univariate polynomial equation with a numerically verified fourthorder convergence rate.
In this study, the approach in ref. [14] is extended to handle curve/curve intersection problems. Unlike the approach in ref. [14], a better bound is chosen for cubic HybClip, and thus the algorithm requires 8% less time than a method that directly uses the cubic hybrid curve [14]. In addition, it is proved that the two sequences in the new clipping algorithm have second and fourthorder convergence rates. Subsequently, a complete comparison is provided with all existing curve/curve intersection algorithms based on subdivisions on a random 40,000 curve/curve intersection database. The new algorithm requires 30% less time than the geometry interval clipping algorithm [11] and 60% less time than the cubic clipping algorithm [10].
The remainder of this paper is organized as follows. In Methods section, the cubic hybrid curves are presented with two moving control points, and the details of the curve/curve intersection algorithms are described when applied in both 2D and 3D. In Results section, a proof of the convergence rate of the new intersection algorithm is provided, and the six techniques are compared from various perspectives. Finally, some concluding remarks are provided in Conclusions section and areas of future work are discussed in Discussion section.
Methods
Hybrid curve
A hybrid curve refers to a curve with at least one moving control point, which is itself a parametric curve and shares one parameter with the hybrid. Sederberg and Kakimoto [12] originated the idea of using hybrid polynomial Bézier curves to approximate rational Bézier curves. Later, North [11] transformed all polynomial Bézier curves of degree d ≥ 2 into equivalent quadratic hybrid curves with a single moving control point and fixed endpoints. As an illustration, a simple quadratic hybrid curve was constructed with a single moving control point, equivalent to a cubic Bézier curve, as shown in Fig. 1.
To evaluate a point on a hybrid curve, the locations of all moving control points are first determined at the given parameter value t. Once the moving control points are determined, the hybrid curve can be evaluated as a common curve. For example, to evaluate \(\hat{\mathbf{P}}(t)\) at t = 0.5, \({\hat{\mathbf{P}}}_1(0.5)\) is first evaluated and the resulting point is then used to evaluate \(\hat{\mathbf{P}}(0.5)\), as shown in Fig. 1.
Using the same principles as in ref. [11], by properly selecting the moving control points, the hybrid curve can produce any traditional Bézier curve. In this study, a hybrid curve having the following form is focused on:
Theorem 1. Given a degree n ≥ 3 Bézier curve P(t) with control points \({\left\{{\mathbf{P}}_i\right\}}_{i=0}^n\), there exists an equivalent cubic hybrid curve \(\hat{\mathbf{P}}(t)\) with two fixed control points \({\hat{\mathbf{P}}}_0={\mathbf{P}}_0,{\hat{\mathbf{P}}}_3={\mathbf{P}}_n\) and two moving control points \({\hat{\mathbf{P}}}_1(t),{\hat{\mathbf{P}}}_2(t)\). The two moving control points \({\hat{\mathbf{P}}}_1(t),{\hat{\mathbf{P}}}_2(t)\) are Bézier curves of degree n − 3 with control points \({\left\{{\hat{\mathbf{P}}}_{1,i1}\right\}}_{i=1}^{n2}\) and \({\left\{{\hat{\mathbf{P}}}_{2,i2}\right\}}_{i=2}^{n1}\), respectively, where
a_{i} = − (n − i)(n − i − 1)(n − i − 2), b_{i} = n(n − 1)(n − 2), c_{i} = − i(i − 1)(i − 2), and i ∈ {1, …, n − 1}.
Proof. The degree n × m tensor product Bézier surface patch [1] is defined as
where \({B}_i^n(s){B}_j^m(t),0\le s,t\le 1\) is the product of the two Bernstein bases in [0, 1], and Q_{i, j}, i = 0, …, n; j = 0, …, m are the control points of Q(s, t).
From ref. [15], a degree m + d Bézier curve P(t) with control points P_{i} can be described as the diagonal curve P(t) = Q(t, t) of a degree m × d Bézier surface Q(s, t), i.e.,
If m = 3, then j ∈ {0, 1, 2, 3} and (j, k) ∈ {(0, i), (1, i − 1), (2, i − 2), (3, i − 3)}. Expanding the summation and rearranging the terms, the following is obtained:
If the control points P_{i} of degree n = d + 3 diagonal curve P(t) are known, Q_{0, i} = P_{0} and Q_{3, i − 3} = P_{n} can be set. Thus,
Simplifying the above formulas, the following is achieved:
for i ∈ {1, …, n − 1}. Setting a_{i} = − (n − i)(n − i − 1)(n − i − 2), b_{i} = n(n − 1)(n − 2), c_{i} = − i(i − 1)(i − 2), and observing that a_{i} + b_{i} + c_{i} = 3i(n − i)(n − 2), the following occur:
Because Q_{0, i} = P_{0} and Q_{3, i − 3} = P_{n}, the s = t diagonal curve of Q(s, t) can be evaluated using the following formula:
where \({\hat{\mathbf{P}}}_1(t)\ \mathrm{and}{\hat{\ \mathbf{P}}}_2(t)\) are the degree n − 3 Bézier curves comprising the control points \({\hat{\mathbf{P}}}_{1,i1}\) and \({\hat{\mathbf{P}}}_{2,i2}\), respectively, where
This is a cubic hybrid curve with two moving control points \({\hat{\mathbf{P}}}_1(t),{\hat{\mathbf{P}}}_2(t)\), and fixed control points P_{0}, P_{n}.
From Theorem 1, if i = 1 or i = n − 1, the first control point of \({\hat{\mathbf{P}}}_1(t)\) and the last control point of \({\hat{\mathbf{P}}}_2(t)\) are fixed as follows:
Theorem 1 indicates that the two moving control points are relevant, for which three cases are discussed:
Case 1
If the first moving control point is a fixed point denoted by \({\hat{\mathbf{Q}}}_1\) and the second moving control point is denoted by \({\hat{\mathbf{Q}}}_2(t)\), then the control points \({\left\{{\hat{\mathbf{Q}}}_{2,i}\right\}}_{i=0}^{n3}\) of \({\hat{\mathbf{Q}}}_2(t)\) can be calculated from Eq. (4), as indicated by Yuan [14]:
Case 2
If the second moving control point is a fixed point denoted by \({\hat{\mathbf{R}}}_2\) and the first moving control point is denoted by \({\hat{\mathbf{R}}}_1(t)\), the control points \({\left\{{\hat{\mathbf{R}}}_{1,i}\right\}}_{i=0}^{n3}\) of \({\hat{\mathbf{R}}}_1(t)\) can be obtained from Eq. (4), i.e.,
Case 3
In general, \({\hat{\mathbf{P}}}_1(t)\) and \({\hat{\mathbf{P}}}_2(t)\) are moving to control points. Because they are equivalent to P(t),
Hence, λ ∈ [0, 1] exists such that
Through a simple approach,
and obtain
where i ∈ {0, …, n − 3}; in addition, \({\hat{\mathbf{Q}}}_1,{\hat{\mathbf{Q}}}_{2,i}\) and \({\hat{\mathbf{R}}}_{1,i},{\hat{\mathbf{R}}}_2\) are known from the two cases above, and based on Eqs. (4) and (13), the two moving control points depend on the value of λ.
Curve/curve intersection based on cubic HybClip
Given two Bézier curves P(t), t ∈ [α, β] and Q(s), s ∈ [ξ, η], in this section, a cubic hybrid clipping algorithm is proposed for computing all intersections.
2D curve/curve intersection
The algorithm for two planar Bézier curves is first discussed. This algorithm is presented in Algorithm 1, and illustrated in Fig. 2.
In each step, one curve is bounded by two lines, called fat lines, which were first introduced in ref. [5]. Let \(\overline{L}\) be a line passing through P_{0} and P_{n} of a degree n Bézier curve, P(t), and suppose \(\overline{L}\) has an implicit equation:
The fat line of P is defined as a region
where [d_{min}, d_{max}] = [min_{0 ≤ i ≤ n}d(P_{i}), max_{0 ≤ i ≤ n}d(P_{i})], and d(P_{i}) = ax_{i} + by_{i} + c, P_{i} = (x_{i}, y_{i}).
The steps of Algorithm 1 are described in more detail in the following:

(1)
In line 1, if the intervals are within the specified level of accuracy, the parameter intervals corresponding to the intersection in line 21 can be directly obtained.

(2)
In line 2, the curve with a larger priority parameter interval is always clipped.

(3)
In line 5, \(\hat{d}(t)\) is a cubic hybrid polynomial in the Bernstein basis,
where

(4)
In line 6, to obtain the cubic lower and upper bounds, defining \(\left[{\hat{d}}_1\right],\left[{\hat{d}}_2\right]\) as the intervals containing the coefficients \(d\left({\hat{\mathbf{P}}}_{1,j}\right)\) and \(d\left({\hat{\mathbf{P}}}_{2,j}\right)\) of \({\hat{d}}_1(t),{\hat{d}}_2(t)\), respectively, \(\hat{d}(t)\) is bound using an interval Bernstein polynomial [16]:
The lower and upper bounds of \(\left[\hat{d}\right](t)\) are defined through cubic polynomials in a simple manner:
Hence, \({\hat{d}}_{\mathrm{min}}(t)\le \hat{d}(t)\le {\hat{d}}_{\mathrm{max}}(t)\). To obtain a tighter bound \(\left[\hat{d}\right](t)\), the following optimization function is used:
where \({\hat{d}}_{i,j}=d\left({\hat{\mathbf{P}}}_{i,j}\right),i=1,2\), and j ∈ {0, 1, …, n − 3}. In Eq. (22), if the second moving point of \(\hat{d}(t)\) is a fixed point denoted by \({\hat{q}}_2\), and the first moving point is denoted by \({\hat{q}}_1(t)\), the following is obtained:
If the first moving point of \(\hat{d}(t)\) is a fixed point denoted by \({\hat{r}}_1\), and the second moving point is denoted by \({\hat{r}}_2(t)\), the following is obtained:
There exists λ ∈ [0, 1] such that
From Eqs. (19) and (25), the problem becomes linear, i.e.,
where j ∈ {0, 1, …, n − 3}. Let \(={\max}_j\left({\hat{q}}_{1,j}\right){\min}_j\left({\hat{q}}_{1,j}\right)\ \mathrm{and}\)\(b={\max}_j\left({\hat{r}}_{2,j}\right){\min}_j\left({\hat{r}}_{2,j}\right)\). If a ≥ b, λ = 1 is set in Eq. (28). Otherwise, λ = 0. The tighter cubic bounds of \(\hat{d}(t)\) can then be obtained using Eqs. (23) and (24).

(5)
In lines 7–10, the intervals of t for which P(t) lies outside of L_{Q} correspond to regions where \(\left[\hat{d}\right](t)\cap \left[{d}_{\mathrm{min}},{d}_{\mathrm{max}}\right]=\varnothing\), as shown in Fig. 3. The values t ∈ [0, 1], for which \({\hat{d}}_{\mathrm{min}}(t)\) and \({\hat{d}}_{\mathrm{max}}(t)\) cross d_{min} and d_{max}, correspond to the roots of
Because \({\hat{d}}_{\mathrm{min}}(t)\) and \({\hat{d}}_{\mathrm{max}}(t)\) are cubic polynomials, these roots can be solved directly using the cubic formula.

(6)
In line 7, if the intersection is empty, no intersection exists between the two curves. In line 11, if the lengths of these intervals are sufficiently small compared to the previous intervals [α, β], HybridClip is applied to line 14. Otherwise, the curve is subdivided into two subsegments and applies HybridClip to the two halves (line 12).
3D curve/curve intersection
The above algorithm can be naturally generalized to handle 3D Bézier curve/curve intersection problems. In the 3D case, “fat lines” in 2D are replaced with several bounding planes, which are called “fat planes.”
Plane \(\overline{L}\) passes through the end control points P_{0} and P_{n} of a degree n Bézier curve, P(t). Because a plane consists of three points that are not collinear, an arbitrary control point is simply chosen that is not on the endpoint line. Here, \(\overline{L}\) is represented using the implicit equation
The fat plane containing curve P(t) and its control points are defined as
where [d_{min}, d_{max}] = [min_{0 ≤ i ≤ n}d(P_{i}), max_{0 ≤ i ≤ n}d(P_{i})], and d(P_{i}) = ax_{i} + by_{i} + cz_{i} + e, P_{i} = (x_{i}, y_{i}, z_{i}). The distance from one curve in a cubic hybrid form is then bound to the fat plane using two cubic polynomials and a strip domain containing the intersections is computed, which is similar to Algorithm 1 described in 2D curve/curve intersection section.
Results
Proof for the convergence rate
Although Yuan’s method [14] is based on cubic HybClip, it is mainly used to solve univariate polynomial root problems. However, a theoretical convergence rate or proof is not provided.
In this section, the theoretical results are provided on the convergence rate of the new curve/curve intersection algorithm. This begins with two technical lemmas:
Lemma 1. For any given polynomial P, there exists two constants C_{P} and D_{P} depending solely on P, such that for all intervals [α, β] ⊆ [0, 1] the lower bound m and the upper bound M generated in line 6 of Algorithm 1 satisfy
where .
Proof. According to Eqs. (22) and (24), P(α) = m(α), P(β) = m(β), and P(t) ≥ m(t), ∀ t ∈ [α, β], and thus
where P_{1}(t) is a continuous function of degree n − 2, and m_{1}(t) is a linear function. Let g(t) = b_{0}(β − t) + b_{1}(t − α) be a line passing through the lowest control point and parallel to the line connecting the end points of P_{1}(t), such that P_{1}(t) − g(t) ≥ 0, ∀ t ∈ [α, β], and thus
where the constant C depends solely on P.
where \({\left\{{c}_i\right\}}_{i=0}^{n2}\) are the control points of g after the degree elevation [1], \({P}_2(t)=\sum_{i=0}^{n3}\left({a}_i{c}_i\right)\left(\genfrac{}{}{0pt}{}{n2}{i}\right){\left(\beta t\right)}^{i1}{\left(t\alpha \right)}^{n2i}\ge 0\), and P_{3}(t) = (a_{n − 2} − c_{n − 2})(t − α)^{n − 3} ≥ 0.
Let t_{1}, t_{2} be the minimum values of P_{2}(t), P_{3}(t) in [α, β], respectively, i.e.,
where s_{1}, s_{2} ∈ [α, β]. Hence,
From Eqs. (34), (35), and (38),
Similarly, M(t) − P(t) < D_{P}h^{4}.
Lemma 2. For any given polynomial P, there exist constants\({C}_i^P,{D}_i^P,\mathrm{with}\ i=0,1,2,3\)depending solely on P, such that for all intervals [α, β] ⊆ [0, 1] the lower bound m and upper bound M generated in line 6 of Algorithm 1 for ∀i ∈ {0, 1, 2, 3} satisfy
where\(h=\beta \alpha, \parallel r{\parallel}_{\infty}^{\left[\alpha, \beta \right]}={\max}_{t\in \left[\alpha, \beta \right]}\leftr(t)\right\).
Proof A new norm in [α, β] is introduced as
According to the equivalence of norms in a finitedimensional real linear space, there exists a constant C such that
where the constant C does not depend on the intervals [α, β], again owing to the affine invariance. Using arguments similar to those in the previous proof, let r = P − m,
Similarly, \(\parallel PM{\parallel}_{\ast}^{\left[\alpha, \beta \right]}\le C\parallel PM{\parallel}_{\infty}^{\left[\alpha, \beta \right]}\le {D}_P{h}^4\).
From the above lemmas, the convergence rate can be analyzed using the HybClip algorithm. In Algorithm 1, if Q = 0, the curve/curve intersection problem P(t) = Q(s) becomes a rootfinding problem P(t) = 0; that is, the cubic HybClip technique may be used to compute the roots of the polynomials and intersections of the two curves. These two cases are discussed separately.
Theorem 2. (Single root) If polynomial P has a root t^{∗}in [α, β], and provided that this root has multiplicity 1, the sequence of the lengths of the intervals generated through cubic HybClip containing that root has the convergence rate d = 4.
Proof. Suppose that ([α_{i}, β_{i}])_{i = 0, 1, 2, …}, which converges to t^{∗}, is a sequence of intervals generated by Algorithm 1, with lengths h_{i} = β_{i} − α_{i}. It is assumed that the first derivative satisfies P^{′}(t^{∗}) > 0 (otherwise, the polynomial −P can be considered instead of P).
Two cubic Bernstein polynomials m and M can be obtained as the lower and upper bounds of P in [α_{i}, β_{i}] based on line 6 of Algorithm 1. Because P^{′} is continuous, and owing to Lemma 2, the following inequalities
hold for all but a finite number of values of i. These three inequalities above imply that
and hence
From Lemma 1, the vertical height δ = δ_{min} + δ_{max} of m and M is bounded by \({C}_P{h}_i^4\). Thus, the length h_{i} of the intervals satisfies
for all but a finite number of values of i (Fig. 4).
For other clipping techniques [8, 9], multiple roots reduce the convergence rate. The convergence rate of cubic HybClip is now discussed in the case of double roots, as illustrated in Fig. 5.
Theorem 3. (Double root) If the polynomial P has a root t^{∗}in [α, β], and provided that this root has multiplicity 2, the sequence of the lengths of the intervals generated by cubic HybClip containing that root has the convergence rate d = 2.
Proof Similar to the proof of the previous theorem, the sequence of intervals ([α_{i}, β_{i}])_{i = 0, 1, 2, …} is analyzed with lengths h_{i} = β_{i} − α_{i} generated by Algorithm 1, which contains the double root. It is assumed that the second derivative satisfies P^{″} > 0. Otherwise, polynomial −P can be considered instead of P.
Again, two cubic Bernstein polynomials m and M can be obtained as the lower and upper bounds of P in [α_{i}, β_{i}]. Because P^{″} is continuous, and based on Lemma 2, the inequalities
hold for all but a finite number of values of i. These two inequalities imply that
and thus \({m}^{{\prime\prime} }(t)\ge \frac{1}{2}{P}^{{\prime\prime}}\left({t}^{\ast}\right),\forall t\in \left[{\alpha}_i,{\beta}_i\right]\). Letting τ = t − t^{∗}, and based on
\(\left{b}_2\right=\frac{1}{2}{m}^{{\prime\prime}}\left({t}^{\ast}\right)\ge \frac{1}{4}{P}^{{\prime\prime}}\left({t}^{\ast}\right)>0\). From Lemmas 1 and 2,
Letting t_{1}, t_{2} be the roots of m, t^{∗} ∈ [t_{1}, t_{2}], and τ_{2} = t_{2} − t^{∗} > 0, τ_{1} = t_{1} − t^{∗} < 0, the following is obtained:
Because τ_{1} ≤ h_{i} and h_{i} → 0, D_{3P}τ_{1} → 0,
for a sufficiently large i. Therefore, \({D}_{2P}{h}_i^4\ge \frac{1}{2}\left{b}_2\right\left{\tau}_1^2\right\ge \frac{1}{8}{P}^{{\prime\prime}}\left({t}^{\ast}\right)\left{\tau}_1^2\right\), and hence
Similarly, the following bound for t_{2} is obtained:
Because τ_{1} < 0, τ_{2} > 0,
Hence, the sequence (h_{i})_{i = 0, 1, 2, …} has a convergence rate of 2.
From Theorems 2 and 3, it can be seen that the new algorithm has a higher convergence rate compared with geometry interval clipping [11] and quadratic clipping [8] when computing all roots of a univariate polynomial equation. The following theorem provides the convergence rate for the curve/curve intersection problems.
Theorem 4. Suppose f(t), g(s) have a transversal intersection (f^{′}(t^{∗}) × g^{′}(s^{∗}) ≠ 0) at p^{∗} = f(t^{∗}) = g(s^{∗}). Furthermore, supposing that [α_{i}, β_{i}]_{i = 0, 1, 2, …}is the sequence of generated intervals that contain t^{∗}, and [ξ_{i}, η_{i}]_{i = 0, 1, 2, …}is the corresponding sequence of generated intervals that contain s^{∗}, there then exist constants C_{1}, C_{2}, C_{3}, C_{4} depending solely on f and g, such that
Proof From line 11 of Algorithm 1, it can be seen that the length of intervals [ξ_{i}, η_{i}] tends toward zero as i tends toward infinity, that is, the interval [ξ_{i}, η_{i}] tends toward s^{∗}.
Let \({\overline{L}}_{\mathbf{g}}\) be the line or plane that passes through the endpoints b_{0}, b_{m} of g in [ξ_{i}, η_{i}]. Denote n as the unit normal vector of \({\overline{L}}_{\mathbf{g}}\). Then, the distance function from f(t) to \({\overline{L}}_{\mathbf{g}}\) is defined as
Denote \({\mathbf{T}}_{\mathbf{f}}^{\ast }\) as the tangent line of f at t^{∗}. Let \(\phi \in \left[0,\frac{\pi }{2}\right]\) be the angle between \({\mathbf{T}}_{\mathbf{f}}^{\ast }\) and \({\overline{L}}_{\mathbf{g}}\), and \(\theta \in \left[0,\frac{\pi }{2}\right]\) be the angles between \({\mathbf{T}}_{\mathbf{f}}^{\ast }\) and b_{0}b_{m}. As h_{i, g} = [ξ_{i}, η_{i}] tends toward 0, the line or plane \({\overline{L}}_{\mathbf{g}}\) converges at b_{0}b_{m}, and angle φ converges at θ. Thus, for a sufficiently small h_{i, g}, \(\phi >\frac{\theta }{2}>0\), and thus \(0<\sin \left(\frac{\theta }{2}\right)<\sin \left(\phi \right)\le 1\).
The angle ρ between f^{′}(t^{∗}) and n is either \(\rho =\frac{\pi }{2}+\phi\) or \(\rho =\frac{\pi }{2}\phi\). Using this, the derivative of the distance function can be bound at the intersection as
Because d^{′}(t^{∗}) ≠ 0, and for convenience, w = d^{′}(t^{∗}) > 0 is denoted (otherwise, the vector −n can be considered instead of n).
Because d^{′}(t) is continuous, the inequality
holds for all but a finite number of values of i. Hence,
From line 6 of Algorithm 1, the cubic polynomial bound [d_{m}(t), d_{M}(t)] of the distance function d(t) can be obtained. Based on Lemma 2,
and by Eq. (61), the following is obtained:
From Fig. 6, the bound for h_{i + 1, f} is obtained as
Based on Lemma 1, the vertical heights δ_{i} of d_{m} and d_{M} are bounded as follows:
Let t_{1} and t_{2} be the roots of d_{m} and d_{M} respectively. From Eq. (63),
From Eq. (64), the above inequality implies that
This thus implies the first inequality in Eq. (57) from \({d}_{\mathrm{max}}{d}_{\mathrm{min}}<{h}_{i,\mathbf{g}}^2{C}_{\mathbf{g}}\) (see the proof of Theorem 6 in ref. [7]). Similarly, in the next iteration step, the following is obtained:
where C′_{f} is solely dependent on f, and C′_{g} is solely dependent on g. Based on the first inequality of Eq. (57), the following is obtained:
which implies the second inequality.
Note that the property of w being nonzero is key to binding l_{1} and l_{3}. Therefore, a transversal intersection is required in the proof. From Theorem 4, the two sequences {[α_{i}, β_{i}]}_{i} and {[ξ_{i}, η_{i}]}_{i} of the new intersection algorithm have second and fourthorder convergence rates, respectively, and the 3D curve intersection problem yields the same results.
Experimental results
In this section, all six algorithms are compared based on three criteria: the amount of time per iteration step, the number of iterations, and the computing time required to achieve a certain accuracy. All algorithms were implemented in C++ on a PC with an 2.60GHz Intel^{(R)} Core^{(TM)} i79750H CPU and 16.0 GB of RAM. In all experiments, both curves P(t) and Q(s) have a parameter domain [0, 1].
For convenience, denote Bézier clipping as BezClip [5]; quadratic clipping and cubic clipping based on a degree reduction as 2DegClip [8] and 3DegClip [10], respectively; geometry interval clipping as 2HybClip [11]; and cubic HybClip based on hybrid curves in ref. [14] as 3HybClip*. In addition, the proposed cubic HybClip algorithm is denoted as 3HybClip.
To analyze the relationship between the computational effort and the desired accuracy, two examples representing polynomials with transversal and tangent intersections are discussed. The five algorithms are first applied to three pairs of Bézier curves with a transversal intersection. Table 1 reports the number of pairs of iterations and the computing time in microseconds of the desired accuracy for computing the transversal intersections between the three curve pairs with various degrees. Figure 7a shows the relationship between the computing time and desired accuracy, and indicates that 3HybClip based on cubic hybrid curves is significantly improved in comparison with BezClip, 2HybClip, 2DegClip, and 3DegClip.
The five algorithms are applied to three pairs of Bézier curves with tangent intersections. Table 2 and Fig. 7b report the number of pairs of iterations and the computing time in milliseconds of various desired accuracies ε for computing the tangent intersections between the three curve pairs with various degrees. Experimental results show that the quadratic and cubic clipping techniques are better than Bézier clipping; however, compared with quadratic clipping based on hybrid curves or a degree reduction, the cubic clipping techniques show no substantial improvements. This is due to the fact that all clipping algorithms require a large number of binary subdivisions for tangent intersections.
To compare these six algorithms numerically, statistics are generated on 40,000 pairs of randomly generated polynomial curves of degree 4–10 for single and multiple intersections. Figure 8 shows computing time needed to achieve the given accuracy of the five algorithms. The relative computing iterations and computing time for these tests are listed in Table 3. As shown in Table 3, 3HybClip requires 2% fewer iterations and 8% less time than 3HybClip* [14]. In addition, 3HybClip has 2% fewer computing iterations than 3DegClip, and at least 10% fewer iterations than 2HybClip and 2DegClip. With respect to the computing time, 3HybClip is at least 60% faster than 3DegClip and 2DegClip, and at least 30% faster than 2HybClip.
Conclusions
In this study, an algorithm called 3HybClip was derived for computing all intersections between two Bézier curves within a given domain. By selecting the moving control points, better bounds were obtained than those in ref. [14]. It was proved that the two sequences of bounded intervals for intersections have second and fourthorder convergence rates for transversal intersections. The experimental results show that the newly proposed 3HybClip algorithm requires 2% fewer iterations and 8% less time than 3HybClip* from ref. [14], 10% fewer iterations than 2HybClip and 2DegClip, and at least 30% less time than other techniques such as BezClip, 2HybClip, 2DegClip, and 3DegClip.
Discussion
As discussed in 3D curve/curve intersection section, for 3D curve/curve intersection problems, the “fat planes” are computed to bound a 3D Bézier curve. The distance from one curve in a cubic hybrid form to the fat plane is bound by two cubic polynomials, and a strip domain containing the intersections is then computed. Similarly, in curve/surface intersection problems, “fat planes” can also be used to bind a Bézier surface, and then the distance from the curve to the fat plane is bound by two cubic polynomials. Then the intersection of “fat planes” and the two cubic polynomials is the strip domain containing the intersections. The details of the algorithm and comparisons with previous approaches are left for future work.
Availability of data and materials
Code sets and date sets: https://gitee.com/yaqiongwu/CurveCurveIntersect.git.
Abbreviations
 CAD/CAM:

Computeraided design and manufacturing
 HybClip:

Hybrid clipping
References
Farin G (2001) Curves and surfaces for CAGD: a practical guide. Morgan Kaufmann Publishers Inc., San Francisco.
Koparkar PA, Mudur SP (1983) A new class of algorithms for the processing of parametric curves. Comput Aided Des 15(1):4145. https://doi.org/10.1016/S00104485(83)800505
Lane JM, Riesenfeld RF (1980) A theoretical development for the computer generation and display of piecewise polynomial surfaces. IEEE Trans Pattern Anal Mach Intell PAMI2(1):3546. https://doi.org/10.1109/TPAMI.1980.4766968
Sederberg TW, Parry SR (1986) Comparison of three curve intersection algorithms. Comput Aided Des 18(1):5863. https://doi.org/10.1016/S00104485(86)800136
Sederberg TW, Nishita T (1990) Curve intersection using Bézier clipping. Comput Aided Des 22(9):538549. https://doi.org/10.1016/00104485(90)90039F
Patrikalakis NM, Maekawa T (2002) Shape interrogation for computer aided design and manufacturing. Springer, Berlin Heidelberg.
Schulz C (2009) Bézier clipping is quadratically convergent. Comput Aided Geom Des 26(1):6174. https://doi.org/10.1016/j.cagd.2007.12.006
Bartoň M, Jüttler B (2007) Computing roots of polynomials by quadratic clipping. Comput Aided Geom Des 24(3):125141. https://doi.org/10.1016/j.cagd.2007.01.003
Liu LG, Zhang L, Lin BB, Wang GJ (2009) Fast approach for computing roots of polynomials using cubic clipping. Comput Aided Geom Des 26(5):547559. https://doi.org/10.1016/j.cagd.2009.02.003
Lou Q, Liu LG (2012) Curve intersection using hybrid clipping. Comput Graph 36(5):309320. https://doi.org/10.1016/j.cag.2012.03.021
North NS (2007) Intersection algorithms based on geometric intervals. Dissertation, Brigham Young University, Utah.
Sederberg TW, Kakimoto M (1991) Approximating rational curves using polynomial curves. Farin G (ed) NURBS for curve and surface design. SIAM, Philadelphia, 144158.
Liu HX, Li X (2010) Convergence analysis and comparison for geometric interval clipping. J Comput Aided Des Comput Graph 22(12):22502258.
Yuan Q (2012) Study on hybrid clipping method for solving polynomial roots. Dissertation, Zhejiang University.
Holliday DJ, Farin GE (1999) A geometric interpretation of the diagonal of a tensorproduct Bézier volume. Comput Aided Geom Des 16(8):837840. https://doi.org/10.1016/S01678396(99)000047
Sederberg TW, Farouki RT (1992) Approximation by interval Bézier curves. IEEE Comput Graph Appl 12(5):8795. https://doi.org/10.1109/38.156018
Acknowledgements
Not applicable.
Funding
This work was supported by the National Key R&D Program of China, No. 2020YFB1708900; and Natural Science Foundation of China, No. 61872328.
Author information
Authors and Affiliations
Contributions
XL provided conceptualization, supervision, formal analysis, methodology, and investigation; YQW provided visualization and validation; and XL and YQW wrote the paper. The authors have read and approved the final manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Wu, Y., Li, X. Curve intersection based on cubic hybrid clipping. Vis. Comput. Ind. Biomed. Art 5, 17 (2022). https://doi.org/10.1186/s42492022001143
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s42492022001143
Keywords
 Bézier curve
 Curve intersection
 Hybrid clipping