It's been a while since I've done this sort of thing, and I'm struggling.
In 2D, I want to detect when a point (p3) is on the wrong side of a line/ray (p1-p2) and move it 'n' units into the 'correct' side of the line. See the diagram below:

I suspect it will need the 2D equivalent of the plane equation, and maybe an intersection point.
Anyone have any code to do this? Any help much appreciated.
In 2D, I want to detect when a point (p3) is on the wrong side of a line/ray (p1-p2) and move it 'n' units into the 'correct' side of the line. See the diagram below:

I suspect it will need the 2D equivalent of the plane equation, and maybe an intersection point.
Anyone have any code to do this? Any help much appreciated.