Gary, Thanks for the information. I went through it very carefully and I understand what you are describing. I believe your numbers do work out properly and it has helped me understand the problem better. After looking through the LocalToWindow code Doug Gehringer has submitted to this group, several times no less, I believe what I want to do is possible. The LocalToWindow code allows you to submit a "model's" x,y,z value. It returns a pixel x and y. It seems as though a reversal of this code should do the trick since I essentially need to submit a pixel x,y value and then have the data x,y,z value returned to me. Once again, I'm not interested in picking an object. In fact, I'm actually interested in having the user add an object to the model. And of course the user could pick an area on the canvas where absolutely no pre-existing objects reside. Unfortunately, I have ZERO math ability. But, I do have a person with the necessary math skills now working on the problem. Alas, he has never done any Java programming so, it is taking a few days here to get him up to speed. He has reviewed your description and agrees with what you are saying. Regards, Gregory Bradford "Gary L. Graf" wrote: > > Hi, > The problem is that the redering process necessarily looses information > in the conversion from 3D to 2D and there is no way to go back and > explicitly reconstruct it. If you think about a perspective view and the > view frustrum, the pixel data at any x - y coordinate on the image plate > originates from objects which lie along a line of sight from the view point > to infinity which goes through the point specified on the image plate. For > example, if you have two objects, one at z distance 5 and another at > distance 10 and both with the same relative x-y coordinates, when projected > the closer object will be twice as far from the center of the view as the > more distant object (If you don't belive me, look straight ahead at the wall > and stick a finger out. If you move the finger closer, while maintaining > movement perpendicular to the wall, the finger starts to move to the edge of > your periphial vision.) > To find your x,y,z position you have to know something about the scene. > The imagePlateToVirtualWorld() will give you a percentage of left/right and > up/down that the screen point is relative to the field of view in the > virtual world. If, for example, your view frustrum was plus/minus 45 > degrees from the center of view, and the returned position is 0.5, then an > object 100 units from the view point will be 50 units off center from the > line of sight. You can now compute a vector by starting at the point of > view and pointing in the direction of the off center point. Run a collision > intercept (eg., pickRay) and the first object it intersects is what you're > looking at (presuming it wasn't transparent). Now you have the distance > along the line of sight to the actual object and you can go back and > calculate the real x,y,z coordinates. > Example: view angle 45 deg > view point = 100, 0, 0 > look at point = 0,0,0 > mouse click returns -0.5,0 > Mouse tells us object is 50% distance to left of > screen and on vertical centerline > Since looking toward orign from down the x axis (and > 45deg view angle), we know that at x = 0 the screen will display the > virtual world at plus minus y = 100 and z = 100. Pick vector endpoint as z > = 50, y = 0. > Run pick ray > Assume returned object is cube of 50 units on a > side with one corner at 0,0,0 and the diagonal at 50,50,50. Run the > calculation of where the pick ray intercepted the cube and you will get the > virtual world x, y, z coordinates as 50, 0, 25 (presuming I didn't make some > simple mistake in this ad hoc example). > I know that this is a somewhat long winded explanation but I hope it > gets the point across. There is room for improvement when you acutally > encode it. > Gary > > Gregory Bradford wrote: > > > Dear Java3d users > > > > I have a Canvas3d object which has a pixel x and pixel y position (say a > > mouse click) for which I'm interested > > in finding my data value. > > > > To explain, I've put into my 3d model only PointArray objects whose > > coordinate values are between -2000.0 and > > 2000.0 on any of the three axis. The actual data isn't important, what > > is important is that I have data whose x coordinates can range from > > -2000.0 to 2000.0. As well as the Y and the Z data. > > > > Assume that at least some of my data, but not all, shows up in the view > > (good field of view, translation, rotation, scale, etc.). > > > > Now all I want to do is supply a (valid for my canvas) pixel X and Y and > > get back a Point3d which indicates what value the pixel X and Y are in > > my data's coordinate system. Thus I need to get back something like > > 233.0, -1387.0, 345.0. > > > > Can somebody get me over this hump in the road. I need a "complete > > solution" that works from beginning to end. > > > > I've tried the following: > > > > TransformGroup vp_trans = null; > > .... > > Point3d position = new Point3d ( ); > > canvas.getPixelLocationInImagePlate(pixel_x, pixel_y, position); > > Transform3D ctf = new Transform3D(); > > vp_trans.getTransform ( ctf ); > > canvas.getImagePlateToVworld( ctf ); > > ctf.transform(position_b); > > > > but the values of position.x and position.y always are between -1.0 and > > 1.0, with 0.0 always being at the center of the canvas. Do I need to > > multiply these returned values by something? > > > > Thanks in advance, > > > > Gregory Bradford > > =========================================================================== > 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".
begin:vcard n:Bradford;Gregory tel;fax:408-736-8447 tel;work:408-736-2822 x-mozilla-html:FALSE adr:;;;;;; version:2.1 email;internet:[EMAIL PROTECTED] fn:Gregory Bradford end:vcard