I’ve decided to add y-at-x methods for the quad. and cubic Beziers with the quadratic implemented first. Both cases will have online demos. For the current Singularity update, I also sneaked in a port of Jack Crenshaw’s TWBRF (more to come when the cubic method is published).
A preview of the quadratic y-at-x method is shown below.
Barring nearly or exactly vertical Beziers, there will be in general no, one, or two y-coordinates for a specified x-coordinate. In general, it is better to allow the caller to decide which of more than one competing value is ‘preferred’ over another. The Singularity implementation returns an Array of Objects containing the t-parameter and y-coordinate for all solutions.
You can check out the online demo here, which includes the usual link to download the latest update to the Singularity package. Cubic case coming soon to a code library near you 🙂