🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

orthogonal projection of 2D point to a 3D plane

Started by
1 comment, last by Alberth 5 years, 4 months ago

I found some guides on how to project a 3D point to a 3D plane. (https://stackoverflow.com/questions/8942950/how-do-i-find-the-orthogonal-projection-of-a-point-onto-a-plane)

However, I wonder if it is possible to do an orthogonal projection of a 2D point onto a 3D plane (defined either by a normal and a point or as a 4D vector normal form)?

The context is that I have fitted a 3D plane to an image scene and then I want to do an orthogonal projection of a 2D image pixel coordinates onto this plane.

Advertisement

Sure you can, it's simple vector math in fact, as long as you're talking rectangles.

Imagine a 2D image, define one corner as (0, 0), and the opposite corner as (xlen, ylen).

Imagine a plane, and define the position on the plane where (0, 0) is going to be as p0, the position on the plane where (xlen, 0) is going to be as px, and the position where (0, ylen) is going to be as py.

Now, a point (x, y). The x component is going to be (px-p0)*x/xlen away from p0 along the edge (0, 0) to (xlen, 0), on the plane. The y component is (py-p0)*y/ylen in a similar way. The end position on the plane is the sum of p0 and both offsets, ie p0 + (px-p0)*x/xlen + (py-p0)*y/ylen. It works because everything is linear.

The simplest way to see it is by having a 'flat' plane, with a constant z. That avoids complicated 3d computations, and your 3d plane can be a simple sheet of paper on a table where you can easily draw the vectors.

This topic is closed to new replies.

Advertisement