This is a plane intersection problem. You have two plane definitions in the point-normal form. The normal is given, and the point is the distance value
w multiplied by the normal.
P with position vector
r is in the plane if and only if the vector drawn from
P is perpendicular to (normal vector)
P_0 is your plane's point,
n is its normal)
If two vectors are perpendicular, their dot product is zero. Your solution is point
P. So you have this equation twice, once for each plane:
n.x * (P.x - P_0.x) + n.y * (P.y - P_0.y) + n.z * (P.z - P_0.z) = 0;
So that leaves you with 3 unknowns and two equations. But lucky you, you happen to know that
P.z is zero. Solve the remaining portion of the system of equations and you are done.