Creating Specific Connections Instead of Nearest Points

hello
My question is: instead of the nearest points , how can i achieve the points shown in the images & create lines ( like yellow colour lines in the picture) with closest points . Any advice or suggestions would be greatly appreciated!
thank you


nearest point doubt.gh (4.8 KB)

maybe this is a solution.


extend_hor.gh (14.2 KB)

special case if the vector x direction is 0.

okay thank you , i thought i can solve my problem with this method but no its not working. i posted other query here , can you check it please , im trying to acheive this soultion to that query . if would to take look and help it would be great