Hi,
I' m getting a strange behavior from PickTool.

I have a quadarray like this.


     GeometryArray array = new QuadArray(4, QuadArray.COORDINATES);
     float[] coord = new float[]{  semiLato, 0, -semiLato,
                                 -semiLato, 0, -semiLato,
                                 -semiLato, 0, semiLato,
                                 semiLato, 0, semiLato};
     array.setCoordinates(0, coord);
     Shape3D shape = new Shape3D(array);
     PickTool.setCapabilities(shape, PickTool.INTERSECT_COORD);

then i use a pick canvas and all works ok. This is the code

     pickCanvas = new PickCanvas(canvas, group);
     ...

     pickCanvas.setShapeLocation(mouseEvent);
     PickResult pRes = pickCanvas.pickClosest();
     if (pRes != null) {
       if (pRes.numIntersections() > 0) {
         log.info("pRes.numIntersections() " + pRes.numIntersections());
         PickIntersection pInt = pRes.getIntersection(0);
         Point3d point = pInt.getPointCoordinatesVW();
         log.info("point " + point );
       }
     }

Then, on the same BranchGroup (in the same program execution, just the
same instance), I use PickTool with this code

     Vector3d direction = new Vector3d(0, -1, 0);
     Point3d eye_pos = new Point3d(x, height, z);

     PickTool pTool = new PickTool(group);
     pTool.setShapeRay(eye_pos, direction);

     PickResult pRes = pTool.pickClosest();
     if (pRes != null) {

       log.info("ok");
       if (pRes.numIntersections() > 0) {

         log.info("num: " + pRes.numIntersections());
         PickIntersection pInt = pRes.getIntersection(0);
         Point3d point = pInt.getPointCoordinatesVW();
         log.info("point " + point );
       }
     }

In this case I always get null as PickResult. I copied the PickTool code
from another program where it works without problems.

I think capabilities are correct because with PickCanvas I have no
problem. I supposed was a eye_pos/direction problem, but I tryed several
combinations, even randomizing in all direction/posiztion.

Any idea ?
How can I debug picking problems ? I tryed to extract info from
PickTool/PickShape and what I get is just what I wrote in.

Thanks.


Bye

===========================================================================
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