# Relating points and planes in a system of homogeneous coordinates

I have a geometrical setup that is shown in the image below. Here, $\boldsymbol{x}$, $\boldsymbol{y}$ and $\boldsymbol{z}$ are orthogonal vectors that I set as my basis vectors to describe the setup. I give this basis a matrix form denoted as $\boldsymbol{R}$, and it is defined as:

$$\boldsymbol{R} = \begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&1\end{bmatrix} \equiv \boldsymbol{I}$$

I define the translation and rotation matrices as:

$$\boldsymbol{Trl}(x_t,y_t,z_t) = \begin{bmatrix}1&0&0&x_t\\0&1&0&y_t\\0&0&1&z_t\\0&0&0&1\end{bmatrix},$$

$$\boldsymbol{Rot}(\alpha,\beta,\gamma) = \begin{bmatrix}1&0&0&0\\0&cos\alpha&-sin\alpha&0\\0&sin\alpha&cos\alpha&0\\0&0&0&1\end{bmatrix} \begin{bmatrix}cos\beta&0&sin\beta&0\\0&1&0&0\\-sin\beta&0&cos\beta&0\\0&0&0&1\end{bmatrix} \begin{bmatrix}cos\gamma&-sin\gamma&0&0\\sin\gamma&cos\gamma&0&0\\0&0&1&0\\0&0&0&1\end{bmatrix}$$

A local coordinate system with orthogonal vectors $\boldsymbol{a}$, $\boldsymbol{b}$ and $\boldsymbol{c}$ containing the plane $D$ at point $O_D$ , is formed by translating the $\boldsymbol{R}$ basis as: $$\boldsymbol{D} = \boldsymbol{Trl}(0,0,Z_d)\boldsymbol{Rot}(0,0,0)\boldsymbol{R} \tag{1}$$

where, $Z_d$ is the distance between the points $O$ and $O_D$.

Similarly, a local coordinate system with orthogonal vectors $\boldsymbol{\chi}$, $\boldsymbol{\psi}$ and $\boldsymbol{\zeta}$ containing the plane $A$ at point $O_A$ , is formed by rotating and then translating the $\boldsymbol{R}$ basis as: $$\boldsymbol{A} = \boldsymbol{Trl}(0,0,Z_a)\boldsymbol{Rot}(0,\phi,0)\boldsymbol{R} \tag{2}$$

where, $Z_a$ is the distance between the points $O$ and $O_A$.

Points $P_D$ and $P_A$ lie on the planes $D$ and $A$ respectively. My intention is to relate the coordinates of the point $P_A$ in terms of the point $P_D$ and $P_O$. To do that I solve equation $(3)$ for $\boldsymbol{r_A}$ (i.e. the coordinates $\chi$ and $\psi$): $$\boldsymbol{r} - \boldsymbol{RAr_A} = (\boldsymbol{RDr_D} - \boldsymbol{RAr_A})t \tag{3}$$

Description of vectors in the image that are used in equation $(3)$: $$\vec{OP_A} = \boldsymbol{RAr_A}$$ $$\ \ \vec{OP_D} = \boldsymbol{RDr_D}$$ $$\ \ \vec{O_DP_D} = \boldsymbol{r_D}$$ $$\ \ \vec{O_AP_A} = \boldsymbol{r_A}$$ $$\ \vec{P_AP_O}= \boldsymbol{r} - \boldsymbol{RAr_A}$$ $$\ \vec{P_AP_D}= \boldsymbol{RDr_D} - \boldsymbol{RAr_A}$$ $$\boldsymbol{r}=\begin{bmatrix}x&y&z&1\end{bmatrix}^T$$ $$\ \boldsymbol{r_D}=\begin{bmatrix}a&b&0&1\end{bmatrix}^T$$ $$\ \boldsymbol{r_A}=\begin{bmatrix}\chi&\psi&0&1\end{bmatrix}^T$$

To solve equation $(3)$, I eliminate $t$ and solve for $\chi$, $\psi$ to get:

$$\chi \:=\:\frac{a\left(Z_a\:-\:z\right)\:+\:x\left(Z_d\:-\:Z_a\right)}{\left(a\:-\:x\right)sin\phi \:+\:\left(Z_d\:-\:z\right)cos\phi } \tag{4}$$ and $$\psi \:=\:\frac{y\left(Z_d\:-\:Z_a\right)\:+\:b\left(Z_a\:-\:z\right)\:+\:\left(ay-bx\right)tan\phi }{Z_d\:-\:z\:+\:\left(a\:-\:x\right)tan\phi } \tag{5}$$

By this way I get $\chi$ and $\psi$ from equation $(3)$ but, When I use a different way to find $\chi$ and $\psi$ I get different results. In the second method I use equation of a line and equate it with the equation of the plane $A$.

Second method:

• I use equation of a line to get equations $(6)$ and $(7)$:

$$\frac{\chi -a}{x-a}\:=\:\frac{\zeta \:-0}{z\:-\:0} \tag{6}$$ $$\frac{\psi -b}{y-b}\:=\:\frac{\zeta \:-0}{z\:-\:0} \tag{7}$$

• To find the equation of the plane $A$, I do the dot product of the vector $\boldsymbol{n}$, which is normal to the plane $A$, with the vector $(\boldsymbol{RAr_A} - \vec{OO_A})$, therefore:

$$\boldsymbol{n}.(\boldsymbol{RAr_A} - \vec{OO_A}) = 0 \tag{8}$$

Here, $\boldsymbol{n}$ vector is obtained by, $$\boldsymbol{n} = \boldsymbol{RA}\begin{bmatrix}0\\0\\\zeta\\1\end{bmatrix} = \begin{bmatrix}\zeta sin\phi\\0\\Z_a + \zeta sin\phi\\1\end{bmatrix}$$

this makes equation $(8)$ as, $$\begin{bmatrix}\zeta sin\phi&0&Z_a + \zeta sin\phi&1\end{bmatrix}\left(\begin{bmatrix}\chi cos\phi\\\psi\\Z_a-\chi sin\phi\\1\end{bmatrix} - \begin{bmatrix}0\\0\\Z_a\\1\end{bmatrix}\right) = 0$$ giving, $$-Z_a\chi sin\phi = 0 \tag{9}$$

once I solve equations $(6)$, $(7)$ and $(9)$ for $\chi$ and $\psi$, I get:

$$\chi = 0 \tag{10}$$ $$\psi = \frac{-xa\:+\:by}{a\:-x} \tag{11}$$

My Problem:

The first and second method give different results. If instead of equation $(8)$, I use $\ \ \boldsymbol{n}.(\boldsymbol{RAr_A}) = 0 \$ I get a closer result to the first method but not exactly the same. I don't seem to get a solution here and I am unable to check which method is correct or whether both are incorrect. What am I doing wrong here, can anyone help me out?

• What exactly are you trying to compute here? I’m finding it a bit hard to tease this out of the mass of symbols in the question. It looks to me that, given $\mathbf p_O$ and $\mathbf p_A$, you want to find the intersection of the line through those points with the $D$-plane and express it in local $D$-coordinates. Is that correct? – amd Jan 23 '18 at 10:03
• @amd I am trying to find out the coordinates of $P_A$, in the central coordinate system that I call $\boldsymbol{R}$, given the coordinates of $P_D$ and $P_O$. I convert coordinates of the point $P_D$ from its local $D$-coordinates to $\boldsymbol{R}$ coordinates by using the transformation $\boldsymbol{RDr_D}$ and the point $P_A$ from its local $A$-coordinates to $\boldsymbol{R}$ coordinates by using the transformation $\boldsymbol{RAr_A}$. Now to find the coordinates of $P_A$, I try to find the intersection of the line that connects the points $P_D$, $P_O$ and $P_A$ with the plane $A$. – radk Jan 23 '18 at 11:02
• @amd sorry, I defined the vectors $\boldsymbol{r_D}$ and $\boldsymbol{r_A}$ incorrectly. I have corrected them now. – radk Jan 23 '18 at 12:09

The intersection of $\overline{P_OP_D}$ with the $A$-plane can be computed directly using homogeneous coordinate methods. To reduce clutter, let ${\mathtt M}_D$ and ${\mathtt M}_A$ be the matrices that map the central (standard) basis to the $D$- and $A$-bases, respectively. If I’ve understood the signs of the translations correctly, for this configuration we have $${\mathtt M}_A = \begin{bmatrix} \cos\phi & 0 & \sin\phi & 0 \\ 0 & 1 & 0 & 0 \\ -\sin\phi & 0 & \cos\phi & z_A \\ 0&0&0&1 \end{bmatrix} \\ {\mathtt M}_D = \begin{bmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1& z_D \\ 0&0&0&1 \end{bmatrix}.$$

First, construct the $A$-plane in central coordinates. The point-normal form $[\mathbf n^T; -\mathbf n^T\mathbf p]^T$ is convenient for this.† A normal $\mathbf n$ of this plane is the image of the unit $z$-vector under ${\mathtt M}_A$, and a known point $\mathbf p$ on the plane is the image of the origin. These are the last two columns of ${\mathtt M}_A$, from which $$\mathbf\pi_A = [\sin\phi:0:\cos\phi:-z_A\cos\phi]^T.$$

The point $\mathbf p_O=[x:y:z:1]^T$ is given, and in the central coordinate system, the other point is ${\mathtt M}_D\mathbf p_D = [a:b:z_D:1]^T$. The intersection of the line through these points with $A$ is $$\mathbf r_A = (\mathbf\pi_A^T\mathbf p_O)\,{\mathtt M}_D\mathbf p_D - (\mathbf\pi_A^T\,{\mathtt M}_D\mathbf p_D)\,\mathbf p_O.\tag{*}$$ (This is the product of the Plücker matrix of the line with the plane.) Grinding through this calculation and simplifying produces (thanks to Mathematica for the heavy lifting) $$x_{\mathbf r_A} = {\left(a z + (x-a) z_A - x z_D\right) \cos\phi \over (x-a)\sin\phi+(z-z_D)\cos\phi} \\ y_{\mathbf r_A} = {(b x-a y) \sin\phi + \left(bz + (y-b)z_A - y z_D\right) \cos\phi \over (x-a)\sin\phi+(z-z_D)\cos\phi} \\ z_{\mathbf r_A} = {\left(x z_D-a z\right) \sin\phi + \left(z-z_D\right) z_A \cos\phi \over {(x-a) \sin\phi - \left(z_D + z\right) \cos\phi} }.$$ Another way to find these coordinates is to form the parametric equation of the line $\mathbf p(t) = (1-t)\mathbf p_O+t\,{\mathtt M}_D\mathbf p_D$, solve $\mathbf\pi_A^T\mathbf p(t)=0$ for $t$, getting $$t = { \left(z-z_A\right) \cos\phi + x \sin\phi \over (x-a) \sin\phi + \left(z-z_D\right) \cos\phi }$$ and then substitute back into $\mathbf p(t)$.

The coordinates of this point in the $A$-system are $\xi = x_{\mathbf r_A}\sec\phi$, $\psi=y_{\mathbf r_A}$ and, of course, $\zeta=0$ (i.e., drop the factor of $\cos\phi$ from the numerator of $x_{\mathbf r_A}$). This value of $\xi$ is a direct match for your first solution, and if you divide the numerator and denominator of this $\psi$ by $-\cos\phi$, the expressions will also match.

Yet another way to obtain this result directly is to treat the problem as a central projection onto the $A$-plane. Taking $\mathbf p_O$ as the view point in the formula for a central projection onto a plane, we would have $$\mathbf r_A = \left(\mathbf p_O \mathbf\pi_A^T-\mathbf p_O^T\mathbf\pi_A\,I_4 \right){\mathtt M}_D\mathbf p_D$$ which, with a little rearrangement, is the same expression as (*). (Not terribly surprising since the projection is essentially computing a line-plane intersection.) You could use $\mathbf r_D = {\mathtt M}_D\mathbf p_D$ as the view point instead, which happily leads to another equivalent expression for $\mathbf r_A$.

As for why your second method produced a different result, I haven’t gone through it in detail, but it appears that your initial equations (6) and (7) are mixing different coordinate systems. You need to work either entirely in the central coordinate system or in the $A$-system if you’re trying to solve for $\xi$ and $\psi$. The former is more convenient. Converting everything into that coordinate system will give you something like $${\xi\cos\phi-a \over x-a} = {z_A-\xi\sin\phi - z_D \over z-z_D}$$ for the first equation. You should end up with a system of linear equations in $\xi$ and $\psi$ that can be solved directly without needing the equation of the $A$-plane. That’s already been accounted for in the transformation to the central coordinate system.

† I’m playing a bit fast and loose with notation here. In this expression I mean the inhomogeneous coordinates in $\mathbb R^3$ of the point and normal. If I were to stick strictly to homogeneous coordinates, it would be something like $\mathbf\pi_A = \mathbf n - (\mathbf n^T\mathbf p)\,\mathbf\pi_\infty$, which I don’t find as instructive.

• Give me some time to understand and check your answer so that I can accept it as the answer. Thanks. – radk Jan 23 '18 at 22:09
• Ok, so my solution, i.e. $\chi$ and $\psi$ in equation $(4)$ and $(5)$, ends up in $A$'s coordinate system. Now, If I do the transformation $\boldsymbol{RAr_A}$, where the coordinates of $\boldsymbol{r_A}$ come from equation $(4)$ and $(5)$, I get the $\boldsymbol{x_{r_A}}$, $\boldsymbol{y_{r_A}}$ and $\boldsymbol{z_{r_A}}$ that you gave in your answer. Is that correct?. – radk Jan 24 '18 at 2:09
• @radk If all has gone well, yes. I don’t really see why you’re bothering to include $R$ in any of this, though. It’s just the identity matrix and only adds to the clutter. – amd Jan 24 '18 at 2:23