# Inscribing a Bezier curve into a rectangle

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?

• Do you want the smallest axis-aligned bounding box?
– lhf
Sep 20 '17 at 11:38
• – lhf
Sep 20 '17 at 11:43
• @lhf. Yes that's what I want. But instead of interpolating all curve's points, i want a direct approach that leads to the same result. do you think it it is possible? Sep 20 '17 at 12:06
• @user2383818 Why, the method Pomax presents is the direct method! Sep 20 '17 at 12:10

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)$.