Hi,

        Thank you for your answer.  It is indeed pretty complex and probably very slow
to do all those calculations.  Like you say, I hope Sun includes such a method
in a future release, I know other 3D libraries offer it and I have to say, it is
a must.

        For now, if this could be of interest to anyone, I have resorted to an
approximation of the 3d point.  I generate a PickRay with the PickObject class,
get the closest Shape3D, and then get the associated Transform3D from the
SceneGraphPath.  Then I use the z component of the Transform3D translation as an
approximation for the z component of the picked point.  I finally use the
PickRay vector to calculate the x and y components of the picked point.

        This is obviously very approximate, but it still does a good job most of the
time.


>   After thinking about this some more it isn't so easy.  When I answered I
> was looking at some code which manually intersects a ray and a single quad
> from a generated ray, which does give the distance to the picked point.  It
> is possible to do what you want but it will take quite a bit of code.
> Maybe the Java3D team at Sun has a better solution???
> 
> 1) pick the closest geometry using the mouse x,y
> 2) get the picked Shape3D from the SceneGraphPath object returned by
> pickClosest
> 3) generate a ray using generatePickRay with the mouse x,y (the same ray
> used to pick the Shape3D)
> 4) intersect that ray with all the quads or tris in the Shap3D's geometry
> (this is a lot of code for all the different geometry types)
> 5) when you find an intersection use the distance, ray origin, and ray
> vector as I described before to get your 3D point
> 
> I would provide this code but it will take a while and I don't need it
> right now.  This is vital functionality so maybe Sun will put it in a
> future release.  It would be MUCH easier to do this inside the pickClosest
> code where the needed information should already be available.
begin:vcard 
n:Bilodeau;Guillaume
tel;work:(613) 991-5037
x-mozilla-html:FALSE
org:National Research Council Canada;Visual Information Technology
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:Software Engineer
x-mozilla-cpt:;-1
fn:Guillaume Bilodeau
end:vcard

Reply via email to