Here's the problem.
In a 2D field, two lines intersect.
I can see what proportion of Line A is to the left of Line B, and I can measure this amount.
I'll express this amount as a number like 0.45
If the amount was 1, it would be the entire length of the line.
So 0.45 means the intersection happens 45% of the way along line A.
Now here's the crazy bit. Those 2D lines, are actually 3D lines; but they look 2D because they're on a flat monitor screen.
The 3D lines exist in 3D space, and their 2D coordinates are being calculated independently in the background.
Here's the thing though - those lines still intersect 45% of the way along in 3D space.
Or wait... maybe they don't...
No wait, THEY DO intersect when viewed from the angle of the camera. That's the whole point.
So yes, when viewed from the angle of the camera, they do intersect at 45% and that's the value we're interested in.
So, given the following:
Line A, formed by:
Line B, formed by:
And in function form,
function Calculate3Dintersection(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
-- code goes here
-- calculate intersectX, intersectY, and intersectZ
How do I calculate intersectX, intersectY, and intersectZ?