A line in 3D runs through 2 points ( ax,ay,az) and ( bx,by,bz)
has an equation
t = (x - ax)/(bx-ax) = (y - ay)/(by-ay) = (z - az)/(bz-az)
To see if the line passes through a point set y = 0 to get t, then
calculate the new x and z to see if they are in the way.
- Pick a hit point ax,0,az and a first origin point bx,by,bz
where -100«=ax«=100 0«=az«=200
- get t using the equations above.
- select new y point ( or z or x) for the second detect point and
calculate a new t'
- use equations above to calculate new other two coordinates.
z = t'(bz-az) + az similar for x or y.