javax.media.j3d
Class PickInfo

java.lang.Object
  extended by javax.media.j3d.PickInfo

public class PickInfo
extends java.lang.Object

The PickInfo object contains the computed information about a pick hit. The detailed information about each intersection of the PickShape with the picked Node can be inquired. The PickInfo object is constructed with basic information and more detailed information can be generated by setting the appropriate mask to the flag argument in the pick methods of BranchGroup and Locale.

Since:
Java 3D 1.4
See Also:
Locale, BranchGroup

Nested Class Summary
 class PickInfo.IntersectionInfo
          The IntersectionInfo object holds extra information about an intersection of a PickShape with a Node as part of a PickInfo.
 
Field Summary
static int ALL_GEOM_INFO
          Specifies that this PickInfo returns all the closest intersection geometry informations.
static int CLOSEST_DISTANCE
          Specifies that this PickInfo returns the closest intersection distance.
static int CLOSEST_GEOM_INFO
          Specifies that this PickInfo returns only the closest intersection geometry information.
static int CLOSEST_INTERSECTION_POINT
          Specifies that this PickInfo returns the closest intersection point.
private  double closestDistance
           
private  Point3d closestIntersectionPoint
           
private  PickInfo.IntersectionInfo[] intersectionInfoArr
           
private  java.util.ArrayList intersectionInfoList
           
private  boolean intersectionInfoListSorted
           
private  Transform3D l2vw
           
private  Transform3D l2vwRef
           
static int LOCAL_TO_VWORLD
          Specifies that this PickInfo returns the computed local to vworld transform.
private  Node node
           
static int NODE
          Specifies that this PickInfo returns the computed intersected Node object.
private  Node nodeRef
           
(package private) static int PICK_ALL
           
(package private) static int PICK_ANY
           
static int PICK_BOUNDS
          Specifies a Pick using the bounds of the pickable nodes.
static int PICK_GEOMETRY
          Specifies a Pick using the geometry of the pickable nodes.
static int SCENEGRAPHPATH
          Specifies that this PickInfo returns the computed SceneGraphPath object.
private  SceneGraphPath sgp
           
 
Constructor Summary
PickInfo()
          PickInfo Constructor
 
Method Summary
(package private)  PickInfo.IntersectionInfo createIntersectionInfo()
           
private static Node[] createPath(NodeRetained srcNode, BranchGroupRetained bgRetained, GeometryAtom geomAtom, java.util.ArrayList initpath)
           
 double getClosestDistance()
          Retrieves the distance between the start point of the pickShape and the closest intersection point.
 Point3d getClosestIntersectionPoint()
          Retrieves the reference to the closest intersection point in this PickInfo object.
 PickInfo.IntersectionInfo[] getIntersectionInfos()
          Retrieves the reference to the array of intersection results in this PickInfo object.
 Transform3D getLocalToVWorld()
          Retrieves the reference to the LocalToVworld transform of the picked node in this PickInfo object.
(package private)  Transform3D getLocalToVWorldRef()
           
 Node getNode()
          Retrieves the reference to the picked node, either a Shape3D or a Morph, in this PickInfo object.
(package private)  Node getNodeRef()
           
(package private) static java.util.ArrayList getPickInfos(java.util.ArrayList initpath, BranchGroupRetained bgRetained, GeometryAtom[] geomAtoms, Locale locale, int flags, int pickType)
          return all PickInfo[] of the geomAtoms.
 SceneGraphPath getSceneGraphPath()
          Retrieves the reference to the SceneGraphPath in this PickInfo object.
(package private) static java.util.ArrayList initSceneGraphPath(NodeRetained nodeR)
          Search the path from nodeR up to Locale.
(package private)  void insertIntersectionInfo(PickInfo.IntersectionInfo iInfo)
           
private static boolean inside(BranchGroupRetained[] bgArr, BranchGroupRetained bg)
          Return true if bg is inside cachedBG or bg is null
private static Node[] mergePath(java.util.ArrayList p1, java.util.ArrayList p2)
          copy p1, (follow by) p2 into a new array, p2 can be null The path is then reverse before return.
(package private) static PickInfo[] pick(java.lang.Object node, GeometryAtom[] geomAtoms, int mode, int flags, PickShape pickShape, int pickType)
           
private static java.util.ArrayList retrievePath(NodeRetained startNode, NodeRetained endNode, HashKey key)
          search the full path from the bottom of the scene graph - startNode, up to the Locale if endNode is null.
(package private)  void setClosestDistance(double cDist)
           
(package private)  void setClosestIntersectionPoint(Point3d cIPt)
           
(package private)  void setLocalToVWorld(Transform3D l2vw)
           
(package private)  void setLocalToVWorldRef(Transform3D l2vwRef)
           
(package private)  void setNode(Node node)
           
(package private)  void setNodeRef(Node nodeRef)
           
(package private)  void setSceneGraphPath(SceneGraphPath sgp)
           
(package private) static void sortGeomAtoms(GeometryAtom[] geomAtoms, PickShape shape)
          Sort the GeometryAtoms distance from shape in ascending order geomAtoms.length must be >= 1
(package private)  void sortIntersectionInfoArray(PickInfo.IntersectionInfo[] iInfoArr)
           
(package private) static void sortPickInfoArray(PickInfo[] pickInfoArr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PICK_ALL

static final int PICK_ALL
See Also:
Constant Field Values

PICK_ANY

static final int PICK_ANY
See Also:
Constant Field Values

sgp

private SceneGraphPath sgp

node

private Node node

l2vw

private Transform3D l2vw

closestIntersectionPoint

private Point3d closestIntersectionPoint

closestDistance

private double closestDistance

intersectionInfoArr

private PickInfo.IntersectionInfo[] intersectionInfoArr

intersectionInfoList

private java.util.ArrayList intersectionInfoList

intersectionInfoListSorted

private boolean intersectionInfoListSorted

l2vwRef

private Transform3D l2vwRef

nodeRef

private Node nodeRef

PICK_BOUNDS

public static final int PICK_BOUNDS
Specifies a Pick using the bounds of the pickable nodes.

See Also:
Constant Field Values

PICK_GEOMETRY

public static final int PICK_GEOMETRY
Specifies a Pick using the geometry of the pickable nodes.

See Also:
Constant Field Values

SCENEGRAPHPATH

public static final int SCENEGRAPHPATH
Specifies that this PickInfo returns the computed SceneGraphPath object.

See Also:
Constant Field Values

NODE

public static final int NODE
Specifies that this PickInfo returns the computed intersected Node object.

See Also:
Constant Field Values

LOCAL_TO_VWORLD

public static final int LOCAL_TO_VWORLD
Specifies that this PickInfo returns the computed local to vworld transform.

See Also:
Constant Field Values

CLOSEST_INTERSECTION_POINT

public static final int CLOSEST_INTERSECTION_POINT
Specifies that this PickInfo returns the closest intersection point.

See Also:
Constant Field Values

CLOSEST_DISTANCE

public static final int CLOSEST_DISTANCE
Specifies that this PickInfo returns the closest intersection distance.

See Also:
Constant Field Values

CLOSEST_GEOM_INFO

public static final int CLOSEST_GEOM_INFO
Specifies that this PickInfo returns only the closest intersection geometry information.

See Also:
Constant Field Values

ALL_GEOM_INFO

public static final int ALL_GEOM_INFO
Specifies that this PickInfo returns all the closest intersection geometry informations.

See Also:
Constant Field Values
Constructor Detail

PickInfo

PickInfo()
PickInfo Constructor

Method Detail

setSceneGraphPath

void setSceneGraphPath(SceneGraphPath sgp)

setNode

void setNode(Node node)

setLocalToVWorld

void setLocalToVWorld(Transform3D l2vw)

setClosestIntersectionPoint

void setClosestIntersectionPoint(Point3d cIPt)

setClosestDistance

void setClosestDistance(double cDist)

setLocalToVWorldRef

void setLocalToVWorldRef(Transform3D l2vwRef)

setNodeRef

void setNodeRef(Node nodeRef)

createIntersectionInfo

PickInfo.IntersectionInfo createIntersectionInfo()

insertIntersectionInfo

void insertIntersectionInfo(PickInfo.IntersectionInfo iInfo)

sortIntersectionInfoArray

void sortIntersectionInfoArray(PickInfo.IntersectionInfo[] iInfoArr)

sortPickInfoArray

static void sortPickInfoArray(PickInfo[] pickInfoArr)

getSceneGraphPath

public SceneGraphPath getSceneGraphPath()
Retrieves the reference to the SceneGraphPath in this PickInfo object.

Returns:
the SceneGraphPath object, or null if flag is not set with SCENEGRAPHPATH.
See Also:
Locale, BranchGroup

getNode

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

Returns:
the picked leaf node object, or null if flag is not set with NODE.
See Also:
Locale, BranchGroup

getLocalToVWorld

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

Returns:
the local to vworld transform, or null if flag is not set with LOCAL_TO_VWORLD.
See Also:
Locale, BranchGroup

getClosestIntersectionPoint

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

Returns:
the closest intersection point, or null if flag is not set with CLOSEST_INTERSECTION_POINT.
See Also:
Locale, BranchGroup

getClosestDistance

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

Returns:
the closest distance in double, or NaN if flag is not set with CLOSEST_INTERSECTION_POINT. Note : If this PickInfo object is returned by either pickClosest or pickAllSorted method, the return value is the closest distance in double even if flag is not set with CLOSET_INTERSECTION_POINT.
See Also:
Locale, BranchGroup

getLocalToVWorldRef

Transform3D getLocalToVWorldRef()

getNodeRef

Node getNodeRef()

getIntersectionInfos

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

Returns:
an array of 1 IntersectionInfo object if flag is to set CLOSEST_GEOM_INFO, or an array of N IntersectionInfo objects containing all intersections of the picked node in sorted order if flag is to set ALL_GEOM_INFO, or null if neither bit is set.
See Also:
Locale, BranchGroup

initSceneGraphPath

static java.util.ArrayList initSceneGraphPath(NodeRetained nodeR)
Search the path from nodeR up to Locale. Return the search path as ArrayList if found. Note that the locale will not insert into path.


createPath

private static Node[] createPath(NodeRetained srcNode,
                                 BranchGroupRetained bgRetained,
                                 GeometryAtom geomAtom,
                                 java.util.ArrayList initpath)

inside

private static boolean inside(BranchGroupRetained[] bgArr,
                              BranchGroupRetained bg)
Return true if bg is inside cachedBG or bg is null


retrievePath

private static java.util.ArrayList retrievePath(NodeRetained startNode,
                                                NodeRetained endNode,
                                                HashKey key)
search the full path from the bottom of the scene graph - startNode, up to the Locale if endNode is null. If endNode is not null, the path is found up to, but not including, endNode or return null if endNode not hit during the search.


mergePath

private static Node[] mergePath(java.util.ArrayList p1,
                                java.util.ArrayList p2)
copy p1, (follow by) p2 into a new array, p2 can be null The path is then reverse before return.


sortGeomAtoms

static void sortGeomAtoms(GeometryAtom[] geomAtoms,
                          PickShape shape)
Sort the GeometryAtoms distance from shape in ascending order geomAtoms.length must be >= 1


getPickInfos

static java.util.ArrayList getPickInfos(java.util.ArrayList initpath,
                                        BranchGroupRetained bgRetained,
                                        GeometryAtom[] geomAtoms,
                                        Locale locale,
                                        int flags,
                                        int pickType)
return all PickInfo[] of the geomAtoms. If initpath is null, the path is search from geomAtom Shape3D/Morph Node up to Locale (assume the same locale). Otherwise, the path is search up to node or null is return if it is not hit.


pick

static PickInfo[] pick(java.lang.Object node,
                       GeometryAtom[] geomAtoms,
                       int mode,
                       int flags,
                       PickShape pickShape,
                       int pickType)


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.