Hi Kevin,

From the PickResult utility code:

---------------------------------------
 boolean intersectTri(int[] vertidx, int[] coordidx, int geomIndex,
            Point3d[] pnts, PickIntersection pi)

   switch(pickShapeType) {
  ...
   case PICK_SHAPE_RAY:
       intersect = intersectRay(triPts, (PickRay) pickShape, pi);
       break;
   case PICK_SHAPE_BOUNDING_SPHERE:
       intersect = intersectBoundingSphere (triPts,
                        (BoundingSphere)pickShapeBounds);
       break;
   ...
  }

 if (intersect) {
       PickIntersection newpi = new PickIntersection(this, pi.geom);
       newpi.iGeom = pi.iGeom;
       newpi.setDistance(pi.distance);
       newpi.setPointCoordinatesVW(pi.getPointCoordinatesVW());  <==
NullPointerException
 }
---------------------------------------

In case of Ray & Segement Shape, pi is passed to intersect routine for
intersection point computation.

However for Bounding Box, Bounding Sphere & Bounding Polytope PickShape
pi is not compute at all. This uninitialize pi is causing
NullPointerException later.

The reason is that there can be multiple point of contacts in those
cases so the utility
does not attempt to compute it. For the case of Cylinder and Cone
PickShape, the result
return is chosen as closest point of penetration, which is just one of
the intersection point
and may not what the user want.


Bug 4822946 -


Picking throws NullPointerException for BoundingBox/Sphere/Polytope PickShape

is submitted for this. It can be fixed by return a zero intersection point
in those cases instead of throwing NullPointerException so you can still get
the geometry and index of triangle intersect.


Thanks.


- Kelvin
------------------
Java 3D Team
Sun Microsystems Inc.


















Kevin Glass wrote:


First off, could someone point me at the location of the list of bugs
for Java3D? I don't seem to be able to get any search results on the
java bug parade?

I keep getting a null point thrown from inside the picking code when I
use a bounding sphere as a pick shape. At the moment I can catch this
exception and use it to indicate that I hit something (since the
exception only occurs when I do). However, I can't actually get to any
of the pick information afterwards (as you'd expect).

The stack trace that gets raised looks like:

java.lang.NullPointerException
       at
com.sun.j3d.utils.picking.PickIntersection.setPointCoordinatesVW(PickIntersection.java:376)
       at
com.sun.j3d.utils.picking.PickResult.intersectTri(PickResult.java:1024)
       at
com.sun.j3d.utils.picking.PickResult.intersectTSA(PickResult.java:1359)
       at
com.sun.j3d.utils.picking.PickResult.intersect(PickResult.java:802)
       at
com.sun.j3d.utils.picking.PickResult.generateIntersections(PickResult.java:635)
       at
com.sun.j3d.utils.picking.PickResult.numIntersections(PickResult.java:422)
       at
com.sun.j3d.utils.picking.PickTool.pickGeomAllSortedIntersect(PickTool.java:854)
       at
com.sun.j3d.utils.picking.PickTool.pickAllSorted(PickTool.java:528)
       at
org.newdawn.pondering.engine.Actor3D.blocked(Actor3D.java:104) <<---
my code

Since the conversation on this list I've gone back to experiment with
picking to follow terrain and the like. Any help, pointers would be
appreciated.

Kev

--
Jose UML - http://www.newdawnsoftware.com/jose
Pondering RPG - http://pondering.newdawnsoftware.com

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

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