Uses math to find the distance from a given point to the line. The demo paints white circles to cover up the red that isn't on the line segment and creates a red line. Use Turbo Mode.
Taken from https://youtu.be/PMltMdi1Wzg