Solve the quadratic equations you want !
I will try to do it also with curves, but it is not certain. Original code in python.