/** * Checks whether the geometry in this shape node intersects with * the specified pickShape. * * @param path the SceneGraphPath to this shape node * @param pickShape the PickShape to be intersected * * @return true if the pick shape intersects this node; false * otherwise. * * @exception IllegalArgumentException if pickShape is a PickPoint. * Java 3D doesn't have spatial information of the surface. * Use PickBounds with BoundingSphere and a small radius, instead. * * @exception CapabilityNotSetException if the Geometry.ALLOW_INTERSECT * capability bit is not set in all of the Geometry objects * referred to by this shape node. */ public boolean intersect(SceneGraphPath path, PickShape pickShape) { return intersect(path, pickShape, null); }
private SceneGraphPath pickGeomAny(int xpos, int ypos) { Node obj; int i; pickRay = (PickRay) generatePickRay(xpos, ypos); sceneGraphPathArr = pickRoot.pickAll(pickRay); for(i=0; i<sceneGraphPathArr.length; i++) { obj = sceneGraphPathArr[i].getObject(); if(obj instanceof Shape3D) { if(((Shape3D) obj).intersect(sceneGraphPathArr[i],(PickShape) pickRay)) return sceneGraphPathArr[i]; } else if(obj instanceof Morph) { if(((Morph) obj).intersect(sceneGraphPathArr[i],(PickShape) pickRay)) return sceneGraphPathArr[i]; } } return null; }
obj = sceneGraphPathArr[i].getObject(); if(obj instanceof Shape3D) { found[i] = ((Shape3D) obj).intersect(sceneGraphPathArr[i], (PickShape) pickRay); } else if(obj instanceof Morph) {
private PickResult pickGeomAny (PickShape pickShape) { Node obj = null; int i; SceneGraphPath[] sgpa = null; if (pickRootBG != null) { sgpa = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgpa = pickRootL.pickAll(pickShape); } if (sgpa == null) return null; // no match for(i=0; i<sgpa.length; i++) { obj = sgpa[i].getObject(); PickResult pr = new PickResult(sgpa[i], pickShape); if(obj instanceof Shape3D) { if(((Shape3D) obj).intersect(sgpa[i], pickShape)) { return pr; } } else if (obj instanceof Morph) { if(((Morph) obj).intersect(sgpa[i], pickShape)){ return pr; } } } return null; }
found[i] = ((Shape3D) obj[i]).intersect(sgp[i], pickShape); } else if (obj[i] instanceof Morph) { found[i] = ((Morph) obj[i]).intersect(sgp[i], pickShape);
obj = sceneGraphPathArr[i].getObject(); if(obj instanceof Shape3D) { found[i] = ((Shape3D) obj).intersect(sceneGraphPathArr[i], pickRay, dist); distArr[i] = dist[0];
pr[i] = new PickResult (sgp[i], pickShape); if (obj[i] instanceof Shape3D) { found[i] = ((Shape3D)obj[i]).intersect(sgp[i], pickShape, dist); distArr[i] = dist[0];