New Degrafa Bezier Methods

I have received a couple requests for x-at-y methods in the advanced quadratic and cubic Bezier classes to complement the existing y-at-x methods.  Fortunately, the algorithm is the same, just a different set of coefficients, so it was an easy addition.

The x-at-y problem is typically used to distribute sprites left-to-right and top-to-bottom along the contour of a Bezier curve.  The y-coordinate of the first sprite is fixed.  The horizontal location is determined by the x-coordinate of the Bezier curve corresponding to the specified y-coordinate (plus some offset).  Sprites are ‘stacked’ along the contour of the curve by incrementing the y-coordinate based on the height of the previous sprite plus some offset, then repeating the algorithm.

The following diagrams illustrate the quadratic and cubic cases.

Quadratic Bezier x-at-y
Quadratic Bezier x-at-y
Cubic Bezier x-at-y
Cubic Bezier x-at-y

These methods are in the AdvancedQuadraticBezier and AdvancedCubicBezier classes.  Update SVN and enjoy.

Advertisement