Degrafa Quad. Bezier Y at X
I finally got around to writing a test program for the advanced quadratic Bezier y-at-x method. In a parametric curve such as a Bezier, the x- and y-coordinates are parameterized as a function of t in [0,1]. There are occasions when an application needs y as a function of x. One common application is when Bezier curves are used to interpolate animation parameters.
It does seem strange using a drawing package like Degrafa for something that is purely computational in nature. There are, however, some drawing applications in which this capability is useful. I once worked on an experimental interface for a designer that was dynamically drawn. The boundary of a certain UI element was a Bezier curve. Depending on which page the user was viewing, a certain number of menu items were dynamically rendered along the boundary. The x-coordinate boundaries were well-known and used to generate y-coordinates to place the dynamic menu items.
The screenshot from the demo shows the previous three-point interpolation used to generate a quad. Bezier. When an interpolation point is moved, a slider becomes active. The slider’s value represents x-coordinates along the interface. As the slider is moved, two markers appear to denote the y-coordinates along the quadratic Bezier corresponding to the input x-coordinate. There are at most two y-coordinates. The t-parameter at each y-coordinate is returned so that this information may be used in applications to choose one y-coordinate over another in the event that only one is required.
As always, update your code base from SVN before playing with the demo. Enjoy!