I'm trying to create an algorithm that could tell if a point lies on a Bézier curve (or very close to it) analytically.
I know that I can check if that's the case by solving $t$ for some ${x,y}$:
$x = a_x(1-t)^3 + 3b_xt(1-t)^2 + 3c_xt^2(1-t)+d_xt^3$
$y = a_y(1-t)^3 + 3b_yt(1-t)^2 + 3c_yt^2(1-t)+d_yt^3$
and if it has solutions in range $[0,1]$, then the point belongs to a Bézier.
$a_x, a_y, ... d_x, d_y $ are Bézier's start point, controls points and end point.
I know how to do that on a piece of paper if I substitute $a_x, a_y, ... d_x, d_y $ with some values, but I have no idea how to create an algorithm for doing that with my computer (mainly because I'm not able to combine polynomial terms since they are connected to $a_x, a_y, ... d_x, d_y $). Could someone please point me to a technique that can be used in such cases or to some source code that does what I want to achieve?