Thanks for the response.  Sounds right to me.  My professor showed me a particular example.  Since the resultant vectors are perpendicular, any point that lies along one of the original axis's are mapped to the new axis.
For example, if a point lies on the u-axis, then it will appear on the new x-axis.
|Ux Uy Uz| |aUx|         |a|
|Vx Vy Vz| |aUy| |----> |0|
|Nx Ny Nz| |aUz|         |0|
Once I saw how the axises were mapped, I was convinced that any other point would also be mapped into the new coordinate system.  Now I understand why the perpendicular vectors map to the x, y, and z plane.  I appreciate your response.  If I said anything incorrectly, please correct me.
 
 /**
  * Kyle Wayne Kelly
  * Computer Science Student
  * University of New Orleans
  * 504-391-3985
  * http://www.cs.uno.edu/~kkelly
  * Glory to God!
  * El temor del hombre pondra lazo;
  * Mas el que confia en Jehova sera exaltado. (Proverbios 29:25)
  */
----- Original Message -----
Sent: Monday, April 23, 2001 8:25 PM
Subject: Re: [JAVA3D] Let me try to say this more clearly

Oops... I was a bit hasty in typing out one of the matrices in my previous message; the corrected matrix is below.
-----Original Message-----
From: Mauricio Vives [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 23, 2001 4:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Let me try to say this more clearly

Kyle,
 
(it looks like you just figured it out, but I was about to send this response anyway; let me know if it is consistent with your newly found wisdom)
 
It looks like you want to be able to describe an object in world coordinates, and view that object from a camera positioned in world coordinates.
 
Let's say that the camera origin is at (Px, Py, Pz), the camera's "up" direction is VUP = (VUPx, VUPy, VUPz), and the camera is looking in the direction DIR = (DIRx, DIRy, DIRz).  These are all defined in world coordinates, which we will call W-space.  This position and two directions ("up" and "forward") define a "frame" or coordinate system, which we will call C-space.  You probably want to have the VUP vector align with the +Y axis of C-space, and the DIR direction align with the -Z axis of C-space.
 
We are missing a vector to align with the +X axis of C-space, the "right" vector: RT = (RTx, RTy, RTz).  So, we need a new "right" vector (in world space) which is perpendicular to VUP and DIR.  This can be computed with a cross product.  Assuming DIR and VUP are normalized (unit length):
 
RT = DIR x VUP
 
Note that RT is normalized, perpendicular to VUP and DIR, and points to the "right" as required.  If you do the cross product in the opposite order, RT will point "left" which is not what we want.
 
With these three vectors, and the camera position (all in W-space) we can easily build a matrix that will take points in C-space and tell us where they are in W-space.  This matrix is:
 
RTx   VUPx   -DIRx   Px
RTy   VUPy   -DIRy   Py
RTz   VUPz   -DIRz   Pz
0   0   0   1
 
Notice that the first column, the "X column", contains the RT vector, and similarly with the second and third columns.  (DIR is negated because we want to look down the -Z axis, not the +Z)
 
However, this matrix is not quite what you need: this matrix take points in C-space and expresses them in W-space, i.e. a "C-to-W" matrix.  I think you really want a matrix that will take points in W-space and express them in C-space, a "W-to-C" matrix.  This is simply the inverse of the C-to-W matrix:
 
(corrected matrix)
RTx   RTy   RTz  (-Px*RTx - Py*RTy - Pz*RTz)
VUPx   VUPy   VUPz  (-Px*VUPx - Py*VUPy - Pz*VUPz)
-DIRx   -DIRy   -DIRz  (Px*DIRx + Py*DIRy + Pz*DIRz)
0   0   0   1
 
(sorry for the bad formatting)  Using the terminology for most graphics APIs, this is a view matrix.
 
This explanation assumes that your are using the "typical" transformation matrix orientation, where the translation parameters are in the fourth column (not the fourth row), i.e.
 
R R R T
R R R T
R R R T
0 0 0 1
-----Original Message-----
From: Kyle Wayne Kelly [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 5:16 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Let me try to say this more clearly

Clarification:  I can easily translate the vrp to the world coordinate origin.  I just want to rotate the viewer's coordinate system so that the axis coincides with the world coordinate system.  Does it have to do with calculating the projection, and then doing the cross product?  I am in dire straits.  Any help is greatly appreciated.
 
 /**
  * Kyle Wayne Kelly
  * Computer Science Student
  * University of New Orleans
  * 504-391-3985
  * http://www.cs.uno.edu/~kkelly
  * Glory to God!
  * El temor del hombre pondra lazo;
  * Mas el que confia en Jehova sera exaltado. (Proverbios 29:25)
  */
----- Original Message -----
Sent: Sunday, April 22, 2001 2:33 PM
Subject: [JAVA3D] Let me try to say this more clearly

I am implementing a 3D system.  I want to shift the viewers reference point to the origin of the world coordinate system.  Second, I want to rotate the viewers coordinate system, so that the users axis lie on top of the world coordinate system.  I want to use properties of special orthogonal matrices.  Can anyone explain how to use special orthogonal matrices to rotate the viewers system to the world coordinate system?  I am implementing this in Java, but I am not using Java3D.  Does anyone know of any web pages that might have good information about this or can explain how this rotation works?  If you can explain using vectors without any actual coding then that would be perfect.
 
 /**
  * Kyle Wayne Kelly
  * Computer Science Student
  * University of New Orleans
  * 504-391-3985
  * http://www.cs.uno.edu/~kkelly
  * Glory to God!
  * El temor del hombre pondra lazo;
  * Mas el que confia en Jehova sera exaltado. (Proverbios 29:25)
  */

Reply via email to