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?


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.

  • $\begingroup$ Thanks! In fact, I need the bounding box for a computer application, to constraint the coponent's canvas where the Bezier curve is drawed. For now, I'm using as canvas, the entire client area of the component's parent. However, the correct approach should be the bounding box. Therefore, sometime in the future, I will have to dig into the math involved and implement your solution! $\endgroup$ Sep 21 '17 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.