hackeron@athena.mit.edu (Harris L Gilliam) (12/15/89)
I need algorithms to convert from world coordinate system to a eye coordinate system. Given a vector in world coordinates that specifies the z' axis, how do I convert points expressed in the world coordinates to points expressed in the coordinate system defined by the given vector. My problem is two-fold: 1) how do I find the x' and y' axes given the z' axis (left or right handed), 2) how do I transform the points once i have the new axes. ---Harris |Harris L. Gilliam () 4 Ames St. Cambridge MA 02139 | |Internet : hackeron@athena.mit.edu () hgilliam@gertie.media.mit.edu | |UUCP : !bloom-beacon!mit-athena!hackeron | |GEnie : H.GILLIAM1 |
dnwiebe@CIS.OHIO-STATE.EDU (Dan N Wiebe) (12/16/89)
Is your eye at the xyz origin? If it's not translate it there, along with all the other points in your world space. Once the eyepoint is at the origin, rotate all your points so that COI (center of interest--some point on your z' vector) is someplace on the positive-z half of the yz plane (rotate around the y axis). Then rotate all your points once more around the x axis until COI lies on the positive z axis (until z and z' coincide). Finally, mirror in z (multiply the z coordinate of all your points by -1). Now, if you want a simple parallel projection, you can just throw out your Z coordinate and plot X and Y on the screen. If you want perspective, you'll have to go through a perspective transform first, shrinking the far-away stuff and stretching the close-up stuff. Multiplying your x and y coordinates by a something containing a factor of 1/-z will work if you're not too picky; otherwise you need to do a bunch of cotangent calculations. But you probably know all that... Hope this helps... Dan Wiebe
shirley@m.cs.uiuc.edu (12/19/89)
There's a trick Don Hearn taught me that has cleaned up my viewing code a lot. Given the orthonormal unit vector set x_hat = (1, 0, 0) y_hat = (0, 1, 0) z_hat = (0, 0, 1) which is just the xyz axes, and a different orthonormal set u_hat = (ux, uy, uz) v_hat = (vx, vy, vz) w_hat = (wx, wy, wz) We can write down a matrix M s.t. x_hat = u_hat * M y_hat = v_hat * M z_hat = w_hat * M | ux uy uz | M = | vx vy vz | | wx wy wz | Then we can write down a matrix N s.t. u_hat = x_hat * N v_hat = w_hat * N w_hat = z_hat * N | ux vx wx | N = | uy vy wy | | uz vz wz | pete shirley shirley@m.cs.uiuc.edu