# Line plane intersection

I have two planes in $\mathbb R^3$ as shown below:

axes representation corrected after MvG's comment

Each plane is a finite area, a rectangle with length and width $H_l, H_w$. Each plane has its own coordinate system, with $x,y$ axes parallel to plane edges and origins of $C1_, C_2$ at $plane_1 , plane_2$ respectively.

Two points $P,e$ belong to plane 1 and plane 2 respectively. Each point is described with respect to the plane's coordinate system.

Point $e(x_e, y_e)$ on $plane_2$ represents the intersection of the line which passes from point $P(x_p, y_p)$ of $plane_1$ and has the direction vector $\overrightarrow S = <S_x, S_y, S_z>$.

Which are the "e" point coordinates ($x_e$,$y_e$) with respect to the coordinates system of the plane it belongs ($plane_2$)?

I have the following data available:

1. Centers of planes: $$C_1(x_1,y_1,z_1), C_1(x_2,y_2,z_2)$$ with respect to the global coordinate system
2. Plane normals: $$\hat n_1 = <n_{x_1}, n_{y_1}, n_{z_1}>, \hat n_2 = <n_{x_2}, n_{y_2}, n_{z_2}>$$
3. Direction vector: $$\overrightarrow S = <S_x, S_y, S_z>$$
4. Point $P(x_p,y_p)$ with respect to the coordinate system of $plane_1$
5. Also the azimuthial and elevation angles for both planes with respect to the global coordinate system $C(0,0,0)$ are known: $alpha_{H_1}, \alpha_{H_1}, alpha_{H_2}, \alpha_{H_2}$

In order to solve the problem:

1. I check if $\overrightarrow S \bullet \hat n_2 = 0$ in this case there is no intersection and point $e$ does not exist.-
2. While I know the $plane_2$ normal vector $\hat n_1$ and point $C_2$ I define the equation of $plane_2$ as: $n_x(x - x_2) + n_y(y - y_2) + n_z(z - z_2) = 0$
3. I write the parametric form of a line $\mathscr P$ with direction vector $\hat S$ that passes from $P(X_p, Y_p, Z_p)$, where $P(X_p, Y_p, Z_p)$ is point $P(x_p, y_p)$ transformed from the coordinate system of $plane_1$ to the global coordinate system (by the way how can I do this transformation?) : $$\mathscr P \begin{cases} x = X_p + S_x t \\ y = Y_p + S_y t \\ z = Z_p + S_z t \end{cases}$$
4. Then from the above equations $t$ can be found and subsequently point $e(X_e, Y_e, Z_e)$ with respect to the global coordinate system.
5. At last I have to transform point $e(X_e, Y_e, Z_e)$ from the global coordinate system to the coordinate system of $plane_2$

Is the above solution right? How can I transform the points between the coordinate systems> Is there any smarter/quicker way to find point $e(x_e,y_e)$?

Is the above solution right?

Looks good to me. Plugging the parametric form of the line into the normal form of the plane is the core of the intersection.

How can I transform the points between the coordinate systems

This appears to be indeed the remaining problem in your setup: transforming in-plane coordinates of $P$ into world coordinates, and then transforming world coordinates of $e$ back to in-plane coordinates.

To do this, you need all three unit vectors of the local coordinate system of each plane. The normals are not enough, since you might rotate the local $x$ and $y$ axis around that normal. Perhaps that azimuth and elevation you have might be of use, but to my knowledge, azimuth and elevation describe a single direction, and you didn't say what direction these describe. If it's the direction of the normal vector, you are out of luck. If it is, however, the direction of the $x$ axis, you could turn that into a unit vector pointing in that particular direction to establish the full local coordinate system.

If you have a set of orthogonal unit vectors $\vec x_1,\vec y_1,\vec z_1$ for plane $1$ (with $\vec z_1$ being a multiple of $\vec n_1$ even though your figure looks different) then you can write $\vec P = \vec C_1 + x_p\vec x_1 + y_p\vec y_1$. If you have a similar set of unit vectors for plane $2$ you can then compute the components using the dot product, i.e. $x_e=\vec x_2\cdot(\vec e - \vec C_2)$ and $y_e=\vec y_2\cdot(\vec e - \vec C_2)$.

Is there any smarter/quicker way to find point $e(x_p,y_p)$?

With quite a bit of background from projective geometry, and in particular using Plücker coordinates, you could come up with a different solution which might be more elegant in some respect, but the practical difference would be negligible here, and the amount of extra knowledge needed to understand things would be rather large, so I'd not suggest a projective approach at this point.

What you can do is combine things. You can write your equation of the plane as a dot product. That way you can write $t$ explicitely as some expression involving dot products. You can write the two products for the conversion to the local coordinate system of the second plane as a matrix multiplication. Then you can split everything up so that you separate the input variables $x_P$ and $y_P$ and end up with a single affine transformation which maps $(x_P,y_P)$ to $(x_e,y_e)$. This is useful if you need to transform many points between the same pair of planes.

• @ MvG Thank you very much! The normal vectors of each plane, $\hat n_1 = <n_{x_1}, n_{y_1}, n_{z_1}>, \hat n_2 = <n_{x_2}, n_{y_2}, n_{z_2}>$ are collinear with the each plane's local z axis, so indeed $\overrightarrow z$ is a multiple of $\overrightarrow n$. I should correct the diagram in order to represent this right. Also the azimuth and elevation angles are defined as such when $alpha_H = 0, \alpha_H = 0$, then the local coordinate system axes are aligned with the global coordinate system axes. – T81 Mar 26 '15 at 7:25
• So in order to fully define the local coordinate systems: $$\hat x = <cos(alpha_H), sin(alpha_H), 0>$$ $$\hat y = \hat z \times \hat x$$ Am I correct? – T81 Mar 26 '15 at 7:43
• I corrected the figure according to MvG's comment – T81 Mar 26 '15 at 8:00