Algorithm for detection of overlaping between vectors I am currently developing a math-physics program and I need to calculate if two vectors overlap one another, the one is vertical and the other is horizontral. Is there any fast algorithm to do this because what I came up so far, has a lot of repeats. Eg lets say we have vector V1((0,1),(2,1)) and a V2((1,0),(1,2)) where the first parenthesis is the coordinates starting and the second coordinates that the vector reaches. I want as a result to take that they overlap at (1,1)

So far the only idea I came up is to ''expand'' each vector to a list of points and then compare the lists e.g for V1 its list would be (0,1) (1,1) (2,1)
If you have two line segments and you want to know if they intersect, see https://en.wikipedia.org/wiki/Line_intersection and https://en.wikipedia.org/wiki/Line_segment_intersection.

For next time, I'd expect you to do more research on your own.  See especially "computational geometry", e.g., a textbook that covers that area.