calculating the point of intersection of two lines
I found a great solution by Paul Bourke. Here it is, implemented in JavaScript: function line_intersect(x1, y1, x2, y2, x3, y3, x4, y4) { var ua, ub, denom = (y4 – y3)*(x2 – x1) – (x4 – x3)*(y2 – y1); if (denom == 0) { return null; } ua = ((x4 – x3)*(y1 – y3) … Read more