Inscribing a Bezier curve into a rectangle

766 Views Asked by At

My goal is to determine the coordinates of the rectangle where a cubic Bezier curve is inscribed. I only know the Start and End points and the two Control points coordinates. Is there a simple formula to determine the rectangle coordinates?

1

There are 1 best solutions below

1
On BEST ANSWER

If the Bézier curve is given by $(x(t),y(t))$, where $t\in [0,1]$ and $x(t)$ and $y(t)$ are cubic polynomials, then the bounding box is given by $[x_{\text{min}},x_{\text{max}}] \times [y_{\text{min}},y_{\text{max}}]$, where $x_{\text{min}}$ is the minimum value attained by $x(t)$ for $t \in [0,1]$, and analogously for the others.

Minimizing $x(t)$ for $t \in [0,1]$ to find $x_{\text{min}}$ reduces to solving a quadratic equation. Don't forget to consider $x(0)$ and $x(1)$.

If you don't need the smallest bounding box, then you can simply use the bounding box of the control points because a Bézier curve is contained in the convex hull of its control points.