Remapping plane parameters for a different Cartesian system

305 Views Asked by At

I'm an IT student and currently I'm working on a project where I work with point clouds. To keep it simple, I use two different Cartesian systems (with different intervals) - one for computations and one for visualizing the results.

I use two points to calculate plane parameters between them - plane perpendicular to the line connecting these two points. These points are normalized into interval [0,1] for the computations. As an output I get the well-known plane parameters:

$a + b + c + d = 0$

a, b and c are simply:

$ a = x_1 - x_2 $

$ b = y_1 - y_2 $

$ c = z_1 - z_2 $

d uses the midpoint between the two points:

$ mid = {P_1 + P_2 \over 2} $

and then:

$ d = - (a * mid_x + b * mid_y + c * mid_z) $

I want to remap these points and the plane into another interval, e.g. [0, 200] - the one I use for the visualization. The points are easily mapped using the linear mapping but I have problems with the plane parameters. For points I use:

$ new\_x = normalized\_x * interval\_range + min\_value $

Here, I'm basically mapping the points back, because when I load them, I first normalize them into the [0, 1] interval with:

$ normalized\_x = {x - min \over interval\_range} $

This doesn't seem to be working correctly for the plane parameters as they are visually way off. My guess is, I'm missing something.

Some examples:

For points (1, 2, 3) and (3, 3, 2) the plane parameters are (-2, -1, 1, 4). Normalized: (0, 0.5, 1) and (1, 1, 0.5) and the plane (-1, -0.5, 0.5, 0.5).

I want to go from the normalized parameters back to the ones in the original interval.

What would be the correct way to remap plane parameters so that in the new coordinate system the plane appears between the same two points that have been remapped?

1

There are 1 best solutions below

0
On BEST ANSWER

You have an equation $a\overline x+b\overline y+c\overline z+d=0$ in normalized coordinates. To get the equation of the plane in unnormalized coordinates, you simply have to substitute into this equation and rearrange: $$a{x-x_{min}\over\Delta x}+b{y-y_{min}\over\Delta y}+c{z-z_{min}\over\Delta z}+d \\ = {a\over\Delta x}x+{b\over\Delta y}y+{c\over\Delta z}z+\left(d-{ax_{min}\over\Delta x}-{by_{min}\over\Delta y}-{cz_{min}\over\Delta z}\right) = 0.\tag 1$$

More generally, if you work with homogeneous coordinates you can represent the plane $ax+by+cz+d=0$ as the homogeneous vector $\mathbf\pi = (a,b,c,d)^T$ so that the equation of the plane becomes $\mathbf\pi^T\mathbf x=0$. If you apply the coordinate transformation $\mathbf x'=M\mathbf x$, you have $$\mathbf\pi^T(M^{-1}\mathbf x') = (M^{-T}\mathbf\pi)^T\mathbf x'=0,$$ therefore the plane transforms as $\mathbf\pi'=M^{-T}\mathbf\pi$.

In your case, $M$ is the denormalization matrix, so that $M^{-1}$ is the original normalization transform. This means that the unnormalized plane parameters can be obtained by applying the transpose of the normalization transform to the normalized plane parameters, or, equivalently, right-multiplying a row vector by the normalization matrix. Specifically, if the normalized plane parameters are $(a,b,c,d)$, then the unnormalized parameters are $$\begin{bmatrix}a&b&c&d\end{bmatrix}\begin{bmatrix}\frac1{\Delta x}&0&0&-{x_{min}\over\Delta x} \\ 0&\frac1{\Delta y}&0&-{y_{min}\over\Delta y} \\ 0&0&\frac1{\Delta z}&-{z_{min}\over\Delta z} \\ 0&0&0&1 \end{bmatrix},$$ which you can verify gives the same result as equation (1).

For your specific example, you have $\Delta x=\Delta y=\Delta z=2$ and $x_{min}=y_{min}=z_{min}=1$. Plugging these values and the normalized plane parameters into equation (1) or the above matrix multiplication produces the parameters $(-0.5,-0.25,0.25,1.0)$, which are equivalent to $(-2,-1,1,4)$, as required.