frontend.java3d
Class SphereWorld

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Group
              extended by javax.media.j3d.BranchGroup
                  extended by frontend.java3d.SphereWorld
All Implemented Interfaces:
java.util.Observer

public class SphereWorld
extends javax.media.j3d.BranchGroup
implements java.util.Observer

SphereWorld represents the Sphere in a graphical sense


Field Summary
 
Fields inherited from class javax.media.j3d.BranchGroup
ALLOW_DETACH
 
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_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
SphereWorld(SphereWorldModel theWorld)
          SphereWorld default constructor
 
Method Summary
 void addChildToMainGroup(javax.media.j3d.Node myChild)
          addChildToMainGroup will add a child to the correct Group
 javax.media.j3d.Background getBkg()
          getBkg returns the background to display
 void getCameraToMouseVec(java.awt.Point clickPos, javax.vecmath.Point3d cameraPoint, javax.vecmath.Vector3d dir)
          getCameraToMouseVec will initialize the given vector to be a vector from the current camera location to the mouse location provided
 javax.vecmath.Point3f getClosestPointToClick(java.awt.Point clickPos)
          getClosestPointToClick will return a valid point on the sphere based on where the user has clicked
 javax.vecmath.Point3f getClosestPointToClick(java.awt.Point clickPos, javax.vecmath.Point3d cameraPoint, javax.vecmath.Vector3d dir)
          getClosestPointToClick will return a valid point on the sphere based on where the user has clicked
 javax.media.j3d.BranchGroup getLighting()
          getLighting returns the lighting information for the Sphere
 javax.vecmath.Point3f getSphereCenter()
          A function to get where the sphere is centered at
 float getSphereRadius()
          Returns the radius of the sphere
 float getSphereRadiusSquared()
          getSphereRadiusSquared returns the radius of the sphere squared it is sorted so it does not do the multiplcation each time
 void setCanvas(javax.media.j3d.Canvas3D myCanv)
          setCanvas will setup the current Canvas3D
 void setLabelState(boolean newState)
          setLabelState allows one to change whether point labels are displayed or not
 void setTransparency(boolean newTrans)
          setTransparency can be used to set the transparency of the sphere
 void update(java.util.Observable arg0, java.lang.Object arg1)
           
 
Methods inherited from class javax.media.j3d.BranchGroup
cloneNode, compile, detach, pickAll, pickAll, pickAllSorted, pickAllSorted, pickAny, pickAny, pickClosest, pickClosest
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, insertChild, moveTo, numChildren, removeAllChildren, removeChild, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SphereWorld

public SphereWorld(SphereWorldModel theWorld)
SphereWorld default constructor

Parameters:
theWorld - is the SphereWorldModel to model
Method Detail

getLighting

public javax.media.j3d.BranchGroup getLighting()
getLighting returns the lighting information for the Sphere

Returns:
a BranchGroup with the lighting

getBkg

public javax.media.j3d.Background getBkg()
getBkg returns the background to display

Returns:
the background to display

getSphereRadius

public float getSphereRadius()
Returns the radius of the sphere

Returns:
The radius of the sphere

getSphereRadiusSquared

public float getSphereRadiusSquared()
getSphereRadiusSquared returns the radius of the sphere squared it is sorted so it does not do the multiplcation each time

Returns:
The radius of the sphere squared

getSphereCenter

public javax.vecmath.Point3f getSphereCenter()
A function to get where the sphere is centered at

Returns:
The center of the sphere

addChildToMainGroup

public void addChildToMainGroup(javax.media.j3d.Node myChild)
addChildToMainGroup will add a child to the correct Group

Parameters:
myChild - the child to add to the Sphere

update

public void update(java.util.Observable arg0,
                   java.lang.Object arg1)
Specified by:
update in interface java.util.Observer

setCanvas

public void setCanvas(javax.media.j3d.Canvas3D myCanv)
setCanvas will setup the current Canvas3D

Parameters:
myCanv -

getClosestPointToClick

public javax.vecmath.Point3f getClosestPointToClick(java.awt.Point clickPos)
getClosestPointToClick will return a valid point on the sphere based on where the user has clicked

Parameters:
clickPos - is the location of the mouse click
Returns:
the Point3f that most closely maps to where the user clicked

getCameraToMouseVec

public void getCameraToMouseVec(java.awt.Point clickPos,
                                javax.vecmath.Point3d cameraPoint,
                                javax.vecmath.Vector3d dir)
getCameraToMouseVec will initialize the given vector to be a vector from the current camera location to the mouse location provided

Parameters:
clickPos - is the point clicked on
cameraPoint - will be used to store the location of the camera
dir - will be used to store the final vector from the camera to the mouse

getClosestPointToClick

public javax.vecmath.Point3f getClosestPointToClick(java.awt.Point clickPos,
                                                    javax.vecmath.Point3d cameraPoint,
                                                    javax.vecmath.Vector3d dir)
getClosestPointToClick will return a valid point on the sphere based on where the user has clicked

Parameters:
clickPos - is the point the user clicked
cameraPoint - will be set to the position of the camera
dir - will be set to the direction from the camera to the point that was clicked on
Returns:

setTransparency

public void setTransparency(boolean newTrans)
setTransparency can be used to set the transparency of the sphere

Parameters:
newTrans - true to make transparent false to make normal.

setLabelState

public void setLabelState(boolean newState)
setLabelState allows one to change whether point labels are displayed or not

Parameters:
newState - if set to true labels are displayed and if set to false labels are disabled