Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

3D coordinate of 2D point given camera and view plane

I wish to generate rays from the camera through the viewing plane. In order to do this, I need my camera position ("eye"), the up, right, and towards vectors (where towards is the vector from the camera in the direction of the object that the camera is looking at) and P, the point on the viewing plane. Once I have these, the ray that's generated is:

ray = camera_eye + t*(P-camera_eye);

where t is the distance along the ray (assume t = 1 for now).

My question is, how do I obtain the 3D coordinates of point P given that it is located at position (i,j) on the viewing plane? Assume that the upper left and lower right corners of the viewing plane are given.

NOTE: The viewing plane is not actually a plane in the sense that it doesn't extend infinitely in all directions. Rather, one may think of this plane as a widthxheight image. In the x direction, the range is 0-->width and in the y direction the range is 0-->height. I wish to find the 3D coordinate of the (i,j)th element, 0

like image 661
Myx Avatar asked Mar 29 '10 15:03

Myx


People also ask

How do you convert 2D coordinates to 3D coordinates?

Word,Excel and many softwares can readily show such images of blocks. To formulate a surface if co-ordinates are given in parametric form x(t),y(t) forming any base contour, then add z=cu, where c is chosen for the depth you want. (x(t),y(t),cu); In general conversion of 2D projection to 3D as you ask is indeterminate.

What determines the position of 3D object point on 2D image plane?

It requires a simple division of the point's x- and y-coordinate by the point's z-coordinate. Before projecting the point onto the canvas, we need to convert the point from world space to camera space. The resulting projected point is defined in image space, and is a 2D point (the z-coordinate can be discarded).

How do you find the coordinates of a point in 3D?

Locate the point “x” on the X-axis. From the point x, moving parallel to the Y-axis, locate the point “y”. Similarly, from the determined point, moving parallel to the Z-axis, locate the point “z”. This is the final coordinate point in the three-dimensional plane, which we are looking for.


1 Answers

General solution of the itnersection of a line and a plane see http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/

Your particular graphics lib (OpenGL/DirectcX etc) may have an standard way to do this

edit: You are trying to find the 3d intersection of a screen point (eg a mouse cursor) with a 3d object in you scene?

like image 58
Martin Beckett Avatar answered Sep 28 '22 13:09

Martin Beckett