is it possible to split a cubic bezier curves into 2 quadratic bezier curves?
- User
is it possible to split a cubic bezier curves into 2 quadratic bezier curves?
- Assistant
Yes, it is possible to approximate a cubic Bézier curve with two quadratic Bézier curves, although it's an approximation rather than an exact equivalence. A cubic Bézier curve is defined by four control points ((P_0, P_1, P_2, P_3)), while a quadratic Bézier curve is defined by three control points.
To approximate a cubic Bézier curve using two quadratic Bézier curves, you typically split the cubic curve at its midpoint. This involves the following steps:
-
De Casteljau’s Algorithm for Midpoint: Use de Casteljau's algorithm to find the midpoint ((t = 0.5)) of the cubic Bézier curve. This process results in two new sets of control points for the two quadratic curves.
-
Control Points of the Quadratic Curves: For the cubic Bézier curve with control points ((P_0, P_1, P_2, P_3)), follow these steps to get two quadratic Bézier curves:
a. Compute the midpoints of each segment joining the control points:
[ Q_0 = \frac{P_0 + P_1}{2}, \quad Q_1 = \frac{P_1 + P_2}{2}, \quad Q_2 = \frac{P_2 + P_3}{2} ]
b. Compute the midpoints of the new segments joining these midpoints:
[ R_0 = \frac{Q_0 + Q_1}{2}, \quad R_1 = \frac{Q_1 + Q_2}{2} ]
c. Finally, compute the midpoint of the segment joining (R_0) and (R_1):
[ S = \frac{R_0 + R_1}{2} ]
Now, you have split the cubic Bézier curve into two segments. The first segment is from (P_0) to (S) and the second is from (S) to (P_3).
-
Forming the Quadratic Bézier Curves: The control points of the two quadratic Bézier curves can be approximated as follows:
a. First Quadratic Bézier Curve (from (P_0) to (S)):
- Start Point: (P_0)
- Control Point: (Q_0)
- End Point: (S)
b. Second Quadratic Bézier Curve (from (S) to (P_3)):
- Start Point: (S)
- Control Point: (Q_2)
- End Point: (P_3)
This method creates an approximation, and the quadratic curves may not perfectly match the original cubic Bézier curve, particularly in regions with high curvature. Nevertheless, it provides a reasonable way to approximate cubic Bézier curves using quadratics. For better accuracy, further refinements and adjustments to the control points may be necessary depending on the required precision.
-
- User
why is it just an approximation? is it possible for it to be exact with the right values?
- Assistant
- User
How do I turn the x position of a cubic bezier into the y position without having to solve a cubic?
- Assistant