Crazy Fences (2012 December Silver)

Can someone please explain the “rayHits” function in the solution to this problem? For example, how are just two parameters, cx and cy representing a ray? Shouldn’t there be a start point and direction vector?

bump

Haven’t read the problem, but I believe cx and cy stand for change_x and change_y. So if you passed 4 for cx and 5 for cy, the vector would be (4, 5).

Could you explain a bit more how the function actually works? Isn’t it checking whether s ray from a specific point hits a line segment. I’m not sure whether everything is being shifted back to the origin…