Here’s a version that adds cusp smoothing. Only the intersection is smoothened, the lines that are drawn are not smoothened. The cusp is also not moved when smoothing so smoothing makes the intersection smaller than the boundary.
I just realised that in merging my slope calculating and intersection finding Desmos plots into one, I missed a bit. This should now be correct:
And here is the Desmos maths converted to Python (simple non NumPy array version) which should hopefully make it simpler to convert to Blink. The Python also uses more meaningful variable names than the Desmos.