Online Example::Quadradic Bezier, Y at X

This example illustates the Bezier2::yAtX() method. In the general case (barring nearly or exactly vertical Beziers), there may be no, one, or two y-values for a given x-coordinate. The yAtX() method returns an array of Objects, each containing the t-parameter and y-value at that t-parameter corresponding to an input x-value in the range of the quadratic Bezier curve. The combination of t-parameter value and y-coordinate allow the caller to determine which of two possible y-coordinates may be 'better' in a specific application.

If the input x-coordinate is outside the range of x-values covered by the Bezier curve covered by t in [0,1], then the returned array contains no values.

This example requires the Flash™ 9 player.

You need to upgrade your Flash Player

This example requires the Flash™ 9 player.

Click in the drawing area to define the three control points. The quad. Bezier is automatically drawn. Click the 'Select x' button and then click anywhere in the drawing area to define an x-coordinate. Markers are placed at appropriate y-coordinates on the Bezier curve at the specified x (if they exist). Click the 'Reset' button to draw a new curve.

For further reading,

:: Quadratic Beizer Curves - Quadratic Beizer's and MovieClip.curveTo().

:: Cubic Bezier Curves - Cubic Bezier's and introduction to quadratic approximation. (to answer the above question)

Source Code. Download the Singularity package (this example is in Singularity/demos/QuadYatX.mxml).