I am using CoreGraphics to draw a quadratic bezier but want to computer the min/max value of the curve. I am not from a mathematical background so this has become a bit troublesome. Does anyone have any articles or ideas about how to solve this?
Share
For a quadratic Bezier, this is actually quite simple.
Define your three control points as
P0 = (x0,y0),P1 = (x1,y1)andP2 = (x2,y2). To find the extrema inx, solve this equation:If
0 <= t <= 1, then evaluate your curve attand store the location asPx. Do the same thing fory:Again, if
0 <= t <= 1, evaluate your curve attand store the location asPy. Finally, find the axis-aligned bounding box containingP0,P2,Px(if found) andPy(if found). This bounding box will also tightly bound your 2D quadratic Bezier curve.