LibreCAD / LibreCAD_3

LibreCAD 3 is a next generation 2D CAD application written to be modular, with a core independent from GUI toolkits. Scripting is possible with Lua.
http://librecad.org
Other
314 stars 103 forks source link

fixed bounding box calculation for cubic beziers #390

Open marco-langer opened 2 years ago

marco-langer commented 2 years ago

The bounding box of the cubic Bézier curve does not contain the second and third control point.

See also the equivalent calculation for the bounding box of the quadratic Bézier curve, which does not contain the second control point.

A graphical interpretation can be found using the interactive tools from the Primer on Béziers. The extremal points of the curve in the interval [0.0, 1.0] are always enclosed within the bounding box of the four control points. If one adds all four control points to the calculation, there is no need anymore to find the roots of the first derivative (but the result will be incorrect).