|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.j3d.utils.pickfast.PickTool
public class PickTool
The base class for optimized picking operations. The picking methods will return a PickInfo object for each object picked, which can then be queried to obtain more detailed information about the specific objects that were picked.
The pick mode specifies the detail level of picking before the PickInfo is returned:
The pick flags specifies the content of the PickInfo(s) returned by the pick methods. This is specified as one or more individual bits that are bitwise "OR"ed together to describe the PickInfo data. The flags include :
PickInfo.SCENEGRAPHPATH
- request for computed SceneGraphPath.PickInfo.NODE
- request for computed intersected Node.PickInfo.LOCAL_TO_VWORLD
- request for computed local to virtual world transform.PickInfo.CLOSEST_INTERSECTION_POINT
- request for closest intersection point.PickInfo.CLOSEST_DISTANCE
- request for the distance of closest intersection.PickInfo.CLOSEST_GEOM_INFO
- request for only the closest intersection geometry information.PickInfo.ALL_GEOM_INFO
- request for all intersection geometry information.When using pickAllSorted or pickClosest methods, the picks will be sorted by the distance from the start point of the pick shape to the intersection point.
Locale.pickClosest(int,int,javax.media.j3d.PickShape)
Field Summary | |
---|---|
static int |
TYPE_BRANCH_GROUP
Flag to pass to getNode(int)
to return a
BranchGroup node from
the SceneGraphPath . |
static int |
TYPE_GROUP
Flag to pass to getNode(int)
to return a
Group node from
the SceneGraphPath . |
static int |
TYPE_LINK
Flag to pass to getNode(int)
to return a
Link node from
the SceneGraphPath . |
static int |
TYPE_MORPH
Flag to pass to getNode(int)
to return a
Morph node from
the SceneGraphPath . |
static int |
TYPE_PRIMITIVE
Flag to pass to getNode(int)
to return a
Primitive node from
the SceneGraphPath . |
static int |
TYPE_SHAPE3D
Flag to pass to getNode(int)
to return a
Shape3D node from
the SceneGraphPath . |
static int |
TYPE_SWITCH
Flag to pass to getNode(int)
to return a
Switch node from
the SceneGraphPath . |
static int |
TYPE_TRANSFORM_GROUP
Flag to pass to getNode(int)
to return a
TransformGroup node from
the SceneGraphPath . |
Constructor Summary | |
---|---|
PickTool(javax.media.j3d.BranchGroup b)
Constructor with BranchGroup to be picked. |
|
PickTool(javax.media.j3d.Locale l)
Constructor with the Locale to be picked. |
Method Summary | |
---|---|
javax.media.j3d.BranchGroup |
getBranchGroup()
Returns the BranchGroup to be picked if the tool was initialized with a BranchGroup, null otherwise. |
int |
getFlags()
Gets the PickInfo content flags. |
javax.media.j3d.Locale |
getLocale()
Returns the Locale to be picked if the tool was initialized with a Locale, null otherwise. |
int |
getMode()
Gets the picking detail mode. |
javax.media.j3d.Node |
getNode(javax.media.j3d.PickInfo pickInfo,
int type)
Get the first node of a certain type up the SceneGraphPath |
javax.media.j3d.PickShape |
getPickShape()
Returns the PickShape for this object. |
javax.vecmath.Point3d |
getStartPosition()
Returns the start postion used for distance measurement. |
javax.media.j3d.PickInfo[] |
pickAll()
Selects all the nodes that intersect the PickShape. |
javax.media.j3d.PickInfo[] |
pickAllSorted()
Select all the nodes that intersect the PickShape, returned sorted. |
javax.media.j3d.PickInfo |
pickAny()
Select one of the nodes that intersect the PickShape |
javax.media.j3d.PickInfo |
pickClosest()
Select the closest node that intersects the PickShape. |
void |
setFlags(int flags)
Sets the PickInfo content flags. |
void |
setMode(int mode)
Sets the picking detail mode. |
void |
setShape(javax.media.j3d.PickShape ps,
javax.vecmath.Point3d startPt)
Sets the pick shape to a user-provided PickShape object |
void |
setShapeBounds(javax.media.j3d.Bounds bounds,
javax.vecmath.Point3d startPt)
Sets the pick shape to use a user-provided Bounds object |
void |
setShapeConeRay(javax.vecmath.Point3d start,
javax.vecmath.Vector3d dir,
double angle)
Sets the pick shape to an infinite PickCone. |
void |
setShapeConeSegment(javax.vecmath.Point3d start,
javax.vecmath.Point3d end,
double angle)
Sets the pick shape to a capped PickCone |
void |
setShapeCylinderRay(javax.vecmath.Point3d start,
javax.vecmath.Vector3d dir,
double radius)
Sets the pick shape to an infinite PickCylinder. |
void |
setShapeCylinderSegment(javax.vecmath.Point3d start,
javax.vecmath.Point3d end,
double radius)
Sets the pick shape to a capped PickCylinder |
void |
setShapeRay(javax.vecmath.Point3d start,
javax.vecmath.Vector3d dir)
Sets the pick shape to a PickRay. |
void |
setShapeSegment(javax.vecmath.Point3d start,
javax.vecmath.Point3d end)
Sets the pick shape to a PickSegment. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_SHAPE3D
getNode(int)
to return a
Shape3D
node from
the SceneGraphPath
.
public static final int TYPE_MORPH
getNode(int)
to return a
Morph
node from
the SceneGraphPath
.
public static final int TYPE_PRIMITIVE
getNode(int)
to return a
Primitive
node from
the SceneGraphPath
.
public static final int TYPE_LINK
getNode(int)
to return a
Link
node from
the SceneGraphPath
.
public static final int TYPE_GROUP
getNode(int)
to return a
Group
node from
the SceneGraphPath
.
public static final int TYPE_TRANSFORM_GROUP
getNode(int)
to return a
TransformGroup
node from
the SceneGraphPath
.
public static final int TYPE_BRANCH_GROUP
getNode(int)
to return a
BranchGroup
node from
the SceneGraphPath
.
public static final int TYPE_SWITCH
getNode(int)
to return a
Switch
node from
the SceneGraphPath
.
Constructor Detail |
---|
public PickTool(javax.media.j3d.BranchGroup b)
public PickTool(javax.media.j3d.Locale l)
Method Detail |
---|
public javax.media.j3d.BranchGroup getBranchGroup()
public javax.media.j3d.Locale getLocale()
public void setShape(javax.media.j3d.PickShape ps, javax.vecmath.Point3d startPt)
ps
- The pick shape to pick against.startPt
- The start point to use for distance calculationspublic void setShapeBounds(javax.media.j3d.Bounds bounds, javax.vecmath.Point3d startPt)
bounds
- The bounds to pick against.startPt
- The start point to use for distance calculationspublic void setMode(int mode)
mode
- One of PickInfo.PICK_BOUNDS or PickInfo.PICK_GEOMETRY.
java.lang.IllegalArgumentException
- if mode is not a legal valuepublic int getMode()
public void setFlags(int flags)
flags
- specified as one or more individual bits that are
bitwise "OR"ed together :
PickInfo.SCENEGRAPHPATH
- request for computed SceneGraphPath.PickInfo.NODE
- request for computed intersected Node.PickInfo.LOCAL_TO_VWORLD
- request for computed local to virtual world transform.PickInfo.CLOSEST_INTERSECTION_POINT
- request for closest intersection point.PickInfo.CLOSEST_DISTANCE
- request for the distance of closest intersection.PickInfo.CLOSEST_GEOM_INFO
- request for only the closest intersection geometry information.PickInfo.ALL_GEOM_INFO
- request for all intersection geometry information.java.lang.IllegalArgumentException
- if any other bits besides the above are set.public int getFlags()
public void setShapeRay(javax.vecmath.Point3d start, javax.vecmath.Vector3d dir)
start
- The start of the raydir
- The direction of the raypublic void setShapeSegment(javax.vecmath.Point3d start, javax.vecmath.Point3d end)
start
- The start of the segmentend
- The end of the segmentpublic void setShapeCylinderSegment(javax.vecmath.Point3d start, javax.vecmath.Point3d end, double radius)
start
- The start of axis of the cylinderend
- The end of the axis of the cylinderradius
- The radius of the cylinderpublic void setShapeCylinderRay(javax.vecmath.Point3d start, javax.vecmath.Vector3d dir, double radius)
start
- The start of axis of the cylinderdir
- The direction of the axis of the cylinderradius
- The radius of the cylinderpublic void setShapeConeSegment(javax.vecmath.Point3d start, javax.vecmath.Point3d end, double angle)
start
- The start of axis of the coneend
- The end of the axis of the coneangle
- The angle of the conepublic void setShapeConeRay(javax.vecmath.Point3d start, javax.vecmath.Vector3d dir, double angle)
start
- The start of axis of the conedir
- The direction of the axis of the coneangle
- The angle of the conepublic javax.media.j3d.PickShape getPickShape()
public javax.vecmath.Point3d getStartPosition()
public javax.media.j3d.PickInfo[] pickAll()
PickInfo
objects which will contain
information about the picked instances. null
if nothing was
picked.public javax.media.j3d.PickInfo pickAny()
PickInfo
object which will contain
information about the picked instance. null
if nothing
was picked.public javax.media.j3d.PickInfo[] pickAllSorted()
PickInfo
objects which will contain
information
about the picked instances. null
if nothing was picked.public javax.media.j3d.PickInfo pickClosest()
PickInfo
object which will contain
information about the picked instance. null
if nothing
was picked.public javax.media.j3d.Node getNode(javax.media.j3d.PickInfo pickInfo, int type)
type
- the type of node we are interested in
java.lang.NullPointerException
- if pickInfo does not contain a
Scenegraphpath or a picked node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |