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