Are you referring to a 2D screen view coordinate being converted to 3D? Without more information you can't simply
convert them...you'd need some idea of the rotation of the point in the 3D and some other references. I don't see how
else you could do that....I could be wrong though.
 
Here is some results of searching on Google for this topic which may help you...and as I mentioned you need some
rotation information....did not verify if this is correct but check it out:
 
 
Comment from chofreither
Date: 09/03/2003 07:07AM PDT
Comment

Are you running in a window? If so, I guess you will have to use
ScreenToClient() to convert the cursor position into client coordinates.

Here's pseudocode for how I converted a client position into a 3d vector,
pointing from the camera into the direction the mouse cursor indicates.
I came up with this myself, so there might be a better way.

vector ScreenPosToVector(x, y)
{
     fx = x - SCREENWIDTH / 2;
     fy = y - SCREENHEIGHT / 2;

     vector proj, vec;

     proj = (fx, fy, ProjectionPlaneDistance);
     vec = proj rotated by the camera's rotation matrix;
     return vec.Normalize();
}

ProjectionPlaneDistance here is the distance from the eye point to
the projection plane; you normally set this when you initialize the
3d graphics mode, though I can't recall how exactly it's done in D3D.

Once you have that vector, the rest is easy: you can now define a
line using the camera's position vector as origin and the vector you
just calculated as the direction and intersect it with your xz-plane.
Since it's flat, the math is trivial:
(I'm improvising here, hope I make no mistakes...)

intersection = campos - (campos.y / direction.y) * direction

Hope that helps,
Clemens
 
 
 
ALSO,
 here is a link to a NeHe site which may help:
 
 
 

   Mario

Mariusz Zaczek
NASA - Johnson Space Center
Automated Vehicles and Orbit Analysis / DM35
Flight Design and Dynamics Division
Mission Operations Directorate
Bldg: 30A     Room: 3040A

Disclaimer: "The opinions, observations and comments expressed in my email
             are strictly my own and do not necessarily reflect those of NASA."

"Failure is never quite so frightening as regret." - Cliff's wife (The Dish)

-----Original Message-----
From: ChaoHui Zhu [mailto:[EMAIL PROTECTED]
Sent: Friday, October 17, 2003 5:12 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Convert from 2D coordinate to 3D Coordinate

Hi, all
  Does anybody has the programme or arithematic to convert 2D coordinate to 3D Coordinate?
  Thanks
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to