> From: Desiree Hilbring <[EMAIL PROTECTED]>
>
> I used your PickingExt package to improve my Picking Behavior, and I am
> able to pick points now, but the problem I am having that in using
> pickClosest, I'll often don't get the Line I wanted to pick, but another
> one, in using pickAll, I'll get the line I wanted to pick and the other
> one.
This is another limitation of the pickingExt packages which should be
documented. pickClosest depends on being able to find the "intersection point"
for the pick, so that the shape with the closest intersection point can be
found. The problem is that the PICK_APERTURE shape doesn't really yield an
"intersection point". The intersection routine (in the core J3D classes)
returns whether the line intersects with the bounding polytope (the volume
defined by the eye and the aperture points), but not the intersection point. As
a result, the pickingExt code can't determine the distance to the intersection
point, so pickAllSorted == pickAll, and pickClosest == pickAny. There isn't a
really good way to fix this. One way would be to sort the primitives by the
distance from the eye to the closest point the bounding box for the primitive,
but that is a pretty crude approximation.
> Does the mean, that my ray is intersection both lines?
Using the PICK_APERTURE mode, this means that both of the lines are within the
aperture around the mouse point. By default, this is a square 8 pixels on a
side, centered on the pick point, but from your code it appears that you've
increased the aperture size to 16 pixels on a side.
> But it doesn't
> look like that, they have a distance of at least 1cm on my sceen?
Well if your aperture is .5 cm and the pick is between the lines, both could be
within the aperture. Decrease your aperture size to get finer picking control.
> And how can I work around it?
It is a thorny issue. The improved picking interfaces in J3D 1.2 should be able
to handle this (I'll look into this to make sure). This functionality should be
available in J3D 1.2 beta (it is not in alpha1).
In the mean time, do a pickAll to get all the prims inside the aperture and then
try to figure out which one you want from the choices you get. One way to
handle this is iterate through the choices, highlighting each one and asking the
user "is this the one you wanted?".
You also could transform the eye point and the line points to VWorld coordinates
and try to figure out which is closest. This is non-trivial, but let me know if
you want to try it and I can lay out the pieces you'll need.
Doug Gehringer
Sun Microsystems
===========================================================================
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".