Java 3DTM 1.4: Picking Changes

This page describes the proposed picking changes in Java 3D 1.4. The main motivation is to improve picking performance. It eliminates the need to rely on the picking utility for extra pick information, such as the color, normal and texture coordinates of the intersection points. This information will be returned, by the new core picking APIs, in a newly created PickInfo class.
 
The proposed API are :

The following 4 methods will be added to Locale and BranchGroup : 

method: public PickInfo[] pickAll( int mode, int flags, PickShape pickShape )
method: public PickInfo[] pickAllSorted( int mode, int flags, PickShape pickShape )
method: public PickInfo pickClosest( int mode, int flags, PickShape pickShape )
method: public PickInfo pickAny( int mode, int flags, PickShape pickShape )

Where

mode is an enum of [ Bounds, Geometry ]
flags is a mask indicating which components are present in each returned PickInfo object. This is specified as one or more individual flags that are bitwise "OR"ed together to describe the returned per PickInfo data.
The flags include:
SCENEGRAPHPATH               - request for computed SceneGraphPath.    
NODE                         - request for computed intersected Node.
LOCAL_TO_VWORLD              - request for computed local to virtual world transform.
CLOSEST_INTERSECTION_POINT   - request for closest intersection point.
CLOSEST_DISTANCE             - request for the closest distance of the intersection.
CLOSEST_GEOM_INFO            - request for only the closest intersection geometry information.
ALL_GEOM_INFO                - request for all intersection geometry information.  
    
NOTES :
If CLOSEST_INTERSECTION_POINT is not set, PickInfo.closestIntersectionPoint is set to null.
If CLOSEST_GEOM_INFO is set, PickInfo.intersectionInfos is of length 1, and PickInfo.intersectionInfos[0] contains the information of the closest pick.
If ALL_GEOM_INFO is set, PickInfo.intersectionInfos contains all intersections of the pickable node in sorted order.
If both CLOSEST_GEOM_INFO and ALL_GEOM_INFO are not set, PickInfo.intersectionInfos is set to null.
An IllegalArgumentException is thrown if  both CLOSEST_GEOM_INFO and ALL_GEOM_INFO are set.
public class PickInfo extends Object   

/** Retrieves the reference to the SceneGraphPath in this PickInfo object. */
method: public SceneGraphPath getSceneGraphPath()

/** Retrieves the reference to the picked node, either a Shape3D or a Morph, in this PickInfo object. */
method: public Node getNode()

/** Retrieves the reference to the LocalToVworld transform of the picked node in this PickInfo object. */
method: public Transform3D getLocalToVWorld()

/** Retrieves the reference to the closest intersection point in this PickInfo object. */
method: public Point3d getClosestIntersectionPoint()

/** Retrieves the distance between the start point of the pickShape and the closest intersection point. */
method: public double getClosestDistance()

/** Retrieves the reference to the array of intersection results in this PickInfo object. */
method: public IntersectionInfo[] getIntersectionInfos()

public class PickInfo.IntersectionInfo extends Object  ( inner class )

/** Retrieves the index to the intersected geometry in the picked node, either a Shape3D or Morph. */
method: public int getGeometryIndex() 

/** Retrieves the reference to the intersected geometry in the picked object, either a Shape3D or Morph. */
method: public Geometry getGeometry()

/** Retrieves the reference to the intersection point of the picked geometry in this IntersectionInfo object. */
method: public Point3d getIntersectionPoint()

/** Retrieves the distance between the start point of the pickShape and the  intersection point. */
method: public double getDistance()

/** Retrieves the vertex indices of the intersected primitive in the geometry. */
method: public int[] getVertexIndices()

/** Retrieves the interpolation weights for each of the verticies of the  intersected primitive. */
method: public float[] getWeights()

Page last updated — $Date$