0

I found this post...

Find coordinates of a 2D plane within a 3D plane

Edit: I rewrote the following for clarity...

I want to translate real-world X, Y, Z coordinates in 3d modeling software to an arbitrary 2d plane that lies within the 3d system of the software. All points in this problem will lie on the arbitrary 2d plane but are expressed as 3d points within the 3d system. I want the points expressed as 2d points within the 2d Cartesian plane, which has its own origin.

This is my best guess implementation, but I do not know if it works in all situations:

$x_o, y_o, z_o$ = given origin point of 2d plane expressed as a point in the 3d system.

$(X_u, Y_u, Z_u)$ = The transform for the 2d plane Y-direction/upwards vector relative to the 3d system; e.g. (0,0,1)

$(X_r, Y_r, Z_r)$ = The transform for the 2d plane X-direction/rightwards vector relative to the 3d system; e.g. (1,0,0)

$x_1, y_1, z_1$ = given coordinates for a point in the 3d system that lies on the 2d plane

$x_2, y_2$ = x, y of the above point as expressed as a point on the 2d Cartesian plane.

Equations:

$$x_2 = (X_r(x_1 - x_o) + Y_r(y_1 - y_o) + Z_r(z_1 - z_o))$$

$$y_2 = (X_u(x_1 - x_o) + Y_u(y_1 - y_o) + Z_u(z_1 - z_o))$$

Not remembering my high school math on the matter, I literally figured these equations out from scratch on a sheet of graph paper, so I have no idea if they are valid.

Any help is appreciated.

  • Imo this is quite hard to read.. a sketch of a drawing will surely clear things up and get you more interested helpers – astro Jan 30 '20 at 20:22
  • Not sure the best way to do that. I think my solution works tho. – Edward Bagby Jan 30 '20 at 21:47
  • 1
    Please format your mathematical expressions using MathJax. – amd Jan 31 '20 at 17:09
  • Finding a suitable transformation is a straightforward computation, but b you can talk about transformations at all, you need to choose a coordinate system for the plane. This amounts to choosing a point on the plane as the origin and two vectors that define direction and unit length of the coordinate axes. These are arbitrary choices. Now, there might be some properties that you want this coordinate system to have, such as othonormality, and you probably have some idea of how you want it to relate to the original 3D coordinates... – amd Jan 31 '20 at 18:21
  • It seems like you have something in mind along those lines, but it’s quite vague in your question. You need to firm up these criteria and make them explicit. – amd Jan 31 '20 at 18:23
  • I rewrote the question for clarity. Hopefully, it makes more sense. – Edward Bagby Jan 31 '20 at 19:35

2 Answers2

1

Let $(x_0, y_0, z_0)$ be the plane origin in 3D space; $(x_U, y_U, z_U)$ be the direction of the plane $u$ axis in 3D space; $(x_V, y_V, z_V)$ be the direction of the plane $v$ axis in 3D space, perpendicular to the $u$ axis; and point $(u, v)$ on the 2D plane corresponding to the same point $(x, y, z)$ in 3D space: $$\begin{cases} x = x_0 + u ~ x_U + v ~ x_V \\ y = y_0 + u ~ y_U + v ~ y_V \\ z = z_0 + u ~z_U + v ~ z_V \\ \end{cases}$$ Conversely, $$\begin{cases} \displaystyle u = \frac{(x - x_0) y_V - (y - y_0) x_V }{ x_U y_V - x_V y_U } = \frac{(x - x_0) z_V - (z - z_0) x_V }{ x_U z_V - x_V z_U } = \frac{(y - y_0) z_V - (z - z_0) y_V }{ y_U z_V - y_V z_U } \\ \displaystyle v = \frac{(y - y_0) x_U - (x - x_0) y_U }{ x_U y_V - x_V y_U } = \frac{(z - z_0) x_U - (x - x_0) z_U }{ x_U z_V - x_V z_U } = \frac{(z - z_0) y_U - (y - y_0) z_U }{ y_U z_V - y_V z_U } \\ \end{cases}$$ In a numerical application, first calculate the divisors, $x_U y_V - x_V y_U$, $x_U z_V - x_V z_U$, and $y_U z_V - y_V z_U$, and use the two with the highest magnitude. This way you get best numerical stability.

(That corresponds to using the two 3D coordinate axes most similar to the 2D plane $u$ and $v$ axes; i.e. dropping the 3D coordinate axis closest to perpendicular to the 2D plane.)

  • @ Anonymous Coward Is this more accurate than my solution? My solution seems to work when the plane aligns with one of the 3d system axes. But I have not tested planes at arbitrary angles relative to the 3d system axes. – Edward Bagby Feb 03 '20 at 18:36
0

If I understand your problem, is it closely related to the calibration of a 3D scanner? Or perhaps the operation of a camera? If so, both of these have extensive descriptions in publically available documents that might be just what you need.

(I am not qualified to make a comment, yet, so I had to add this answer instead.)