Compare cursor location to forward vector of spline

Hello forums.

I’m in the process of developing functionality to “construct” a conveyor line using splines. Within my game world, I have a grid restriction when constructing objects. To better explain this, refer to the image below.
Grid-restrictions.png
Green lines: The spline can move this direction
Red line: The spline must not move this direction

Expected behavior
If the player chooses a certain grid space, and start dragging the mouse whilst holding down the left mouse button, the last spline point will change it’s location within the grid limits (50 units).
For every tick, I check the mouse location to see whether it’s “above” the right line, meaning close to the splines forward vector, or if it’s “below” the red line, meaning it’s now close to the X axis and the new location of the last spline point, should be limited to the X axis, instead of the Y. Furthermore, the forward vector of the spline should now be X instead of Y.

For now, the issue I’m fighting with, is how to check whether the cursor world location is closer to the X axis than the Y axis. Consider the image below:
Change-forward-vector.png
Green line with arrow: The current forward vector of the spline, and the direction the spline should move when dragging the mouse
Blue cross: The cursor world location
Bottom green line: The wanted spline direction and location

When the cursor location is at the blue cross, I now want the spline to move on the X axis, and change it’s forward vector, instead of the Y axis.

I hope that some of you can guide me towards a solution.

It will involve deprojected screen position to world position:

… and projecting world position to screen position:

That should get you started. :cool: