Finding Point of intersection

Im currently working on curved road code for my free-time project. The question is, how can I find coordinates of yellow point. (Black are bricks).

The whole idea is to change length of those black bricks to allign and connect properly. But I dont know how to calculate distance to that point.

The only thing that came to my head, was usage of raycast.

(Im not asking for a code or uncopylocked place, but rather advice / decision to geometrical question, Im good enough to script it, but dont know how to script it)

Problem visualisation:

1 Like

im not an expert to this but im guessing that you need to use Raycasts and CFrame:ToObjectSpace() for that

1 Like

From what I know you will have to find direction vectors representing the direction the lines x1 and x2 are moving in and the positions of the edges from which x1 and x2 originate from. After that you
will have to solve for r and s in the equation originX1 + r * directionX1 = originX2 + s * directionX2. Replacing r in the equation originX1 + r * directionX1 with the value you solved for in the equation above should then give you the coordinates for the point you are trying to find. I’m sure there are probably other ways to do it but that’s the first thing I could come up with.