NCSA Portfolio

ncsa.j3d
Class PickableTransformGroup

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Group
                    |
                    +--javax.media.j3d.TransformGroup
                          |
                          +--ncsa.j3d.SimpleTransformGroup
                                |
                                +--ncsa.j3d.PickableTransformGroup
Direct Known Subclasses:
CollidableTransformGroup, MulticastTransformGroup, RecordableTransform

public class PickableTransformGroup
extends SimpleTransformGroup

This class extends SimpleTransformGroup and adds support for picking.

The support for picking is added by modifying the capabilities of this class to allow picking. And also by providing a static function to cast rays and return the closest PickableTransformGroup that intersects with the ray. This class is designed to do picking based on Mouse coordinates.


Fields inherited from class javax.media.j3d.TransformGroup
ALLOW_TRANSFORM_READ, ALLOW_TRANSFORM_WRITE
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICK, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
PickableTransformGroup()
          Default Constructor
PickableTransformGroup(javax.vecmath.Vector3f initial)
          The constructor with support for a permanent initial offset.
 
Method Summary
static javax.media.j3d.PickShape generatePickRay(int xpos, int ypos, javax.media.j3d.Canvas3D canvas)
          Creates a PickRay that starts at the viewer position and points into the scene in the direction of (xpos, ypos) specified in window space.
 java.lang.String getName()
          Allows retrieval of the name.
static PickableTransformGroup selectNode(javax.media.j3d.Canvas3D canvas, javax.media.j3d.BranchGroup root, int xpos, int ypos)
          Returns the closest PickableTransformGroup or null.
 void setName(java.lang.String name)
          Allows the setting of the name.
 
Methods inherited from class ncsa.j3d.SimpleTransformGroup
get, get, get, move, move, reset, rotX, rotY, rotZ, scale, scale, set, set, set, set, set
 
Methods inherited from class javax.media.j3d.TransformGroup
cloneNode, duplicateNode, getTransform, setTransform
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, insertChild, moveTo, numChildren, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PickableTransformGroup

public PickableTransformGroup(javax.vecmath.Vector3f initial)
The constructor with support for a permanent initial offset.
Parameters:
initial - The initial offset of the group if any.

PickableTransformGroup

public PickableTransformGroup()
Default Constructor
Parameters:
none -  
Method Detail

setName

public void setName(java.lang.String name)
Allows the setting of the name. If this is never called, a default name is assigned to this Transform. It will be TransformGroupX where the x is a number that represents how many of these objects were created prior to this object. The first object created would by default be named TransformGroup0.
Parameters:
name - The new Name.

getName

public java.lang.String getName()
Allows retrieval of the name.

generatePickRay

public static javax.media.j3d.PickShape generatePickRay(int xpos,
                                                        int ypos,
                                                        javax.media.j3d.Canvas3D canvas)
Creates a PickRay that starts at the viewer position and points into the scene in the direction of (xpos, ypos) specified in window space.
Parameters:
xpos - The value along the x-axis.
ypos - The value along the y-axis.
Returns:
A PickShape object that is the constructed PickRay.

selectNode

public static PickableTransformGroup selectNode(javax.media.j3d.Canvas3D canvas,
                                                javax.media.j3d.BranchGroup root,
                                                int xpos,
                                                int ypos)
Returns the closest PickableTransformGroup or null.
Parameters:
c - The canvas to select on.
root - The BranchGroup to select under.
xpos - Mouse X pos.
ypos - Mouse Y pos.

NCSA Portfolio

NCSA Portfolio, Copyright 1997-1999, National Center for Supercomputing Applications, University of Illinois Urbana-Champaign, All Rights Reserved