gnu.gleem
Class HandleBoxManip

java.lang.Object
  |
  +--gnu.gleem.Manip
        |
        +--gnu.gleem.HandleBoxManip

public class HandleBoxManip
extends Manip

Patterned after Inventor's HandleBoxManip (by Paul Isaacs and David Mott) and TransformerManip (by Paul Isaacs). Center box allows 3-D translation. Outer six handles allow rotation about the box's six axes. When a handle is clicked, the axis of rotation is immediately chosen as that which is most parallel to the viewing direction (note there are at most two possibilities for the axis of each handle's rotation). Eight corner handles allow aspect ratio-preserving scaling; shift-dragging these handles allows non-uniform scaling in one of two possible directions using a "snap-to-axis" paradigm. These two directions are chosen as the axes of the adjacent face to the handle whose normal most directly faces the viewing direction.


Constructor Summary
HandleBoxManip()
          Default HandleBoxManip has translation (0, 0, 0) and the identity orientation
 
Method Summary
 void clearHighlight()
          Tell the manipulator to clear the current highlight
 void drag(Vec3f rayStart, Vec3f rayDirection)
          When a manipulator is active, drags of the live portion cause motion of the manipulator.
 Vec3f getGeometryScale()
           
 Rotf getRotation()
          Get the rotation of this HandleBoxManip.
 Vec3f getScale()
           
 Vec3f getTranslation()
          Get the translation of this Translate1Manip.
 void highlight(HitPoint hit)
          Tell the manipulator to highlight the current portion of itself.
 void intersectRay(Vec3f rayStart, Vec3f rayDirection, java.util.List results)
          Cast a ray in 3-space from the camera start position in the specified direction and test for intersections against all live portions of this manipulator.
 void makeActive(HitPoint hit)
          If the ManipManager decides that this manipulator is to become active, it will pass back the HitPoint which made it make its decision.
 void makeInactive()
          When the mouse button is released, makeInactive() is called.
 void render(gl4java.GLFunc gl)
          Render this Manipulator now using the given OpenGL routines and assuming an OpenGL context is current.
 void setGeometryScale(Vec3f geometryScale)
          Set the scale of the HandleBoxManip's geometry.
 void setRotation(Rotf rotation)
          Set the rotation of this HandleBoxManip.
 void setScale(Vec3f scale)
          Set the scale of the HandleBoxManip.
 void setTranslation(Vec3f translation)
          Set the translation of this HandleBoxManip.
 
Methods inherited from class gnu.gleem.Manip
addMotionListener, removeMotionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandleBoxManip

public HandleBoxManip()
Default HandleBoxManip has translation (0, 0, 0) and the identity orientation

Method Detail

setTranslation

public void setTranslation(Vec3f translation)
Set the translation of this HandleBoxManip. This moves its on-screen representation. Manipulations cause the translation to be modified, not overwritten.


getTranslation

public Vec3f getTranslation()
Get the translation of this Translate1Manip. This corresponds to the center of its body.


setRotation

public void setRotation(Rotf rotation)
Set the rotation of this HandleBoxManip.


getRotation

public Rotf getRotation()
Get the rotation of this HandleBoxManip.


setScale

public void setScale(Vec3f scale)
Set the scale of the HandleBoxManip. This corresponds to the scaling the user has performed.


getScale

public Vec3f getScale()

setGeometryScale

public void setGeometryScale(Vec3f geometryScale)
Set the scale of the HandleBoxManip's geometry. This only affects its on-screen representation. It is probably a bad idea to use a non-uniform scale here, because it'd be very confusing to the user. None of the components of the geometryScale vector may be negative.


getGeometryScale

public Vec3f getGeometryScale()

render

public void render(gl4java.GLFunc gl)
Description copied from class: Manip
Render this Manipulator now using the given OpenGL routines and assuming an OpenGL context is current.

Specified by:
render in class Manip

intersectRay

public void intersectRay(Vec3f rayStart,
                         Vec3f rayDirection,
                         java.util.List results)
Description copied from class: Manip
Cast a ray in 3-space from the camera start position in the specified direction and test for intersections against all live portions of this manipulator. Add all hits, in arbitrary order, to the end of the given list in the form of HitPoints. Must not modify the results vector in any other way (i.e., must not remove any existing HitPoints from the results vector).

Specified by:
intersectRay in class Manip

highlight

public void highlight(HitPoint hit)
Description copied from class: Manip
Tell the manipulator to highlight the current portion of itself. This is merely visual feedback to the user.

Specified by:
highlight in class Manip

clearHighlight

public void clearHighlight()
Description copied from class: Manip
Tell the manipulator to clear the current highlight

Specified by:
clearHighlight in class Manip

makeActive

public void makeActive(HitPoint hit)
Description copied from class: Manip
If the ManipManager decides that this manipulator is to become active, it will pass back the HitPoint which made it make its decision. The manipulator can then change its state to look for drags of this portion of the manipulator.

Specified by:
makeActive in class Manip

drag

public void drag(Vec3f rayStart,
                 Vec3f rayDirection)
Description copied from class: Manip
When a manipulator is active, drags of the live portion cause motion of the manipulator. The ManipManager keeps track of which manipulator (if any) is active and takes care of calling the drag() method with the current ray start and direction. The manipulator must keep enough state to understand how it should position and/or rotate itself. NOTE that the base class provides an implementation for this method which you must call at the end of your overriding method.

Overrides:
drag in class Manip

makeInactive

public void makeInactive()
Description copied from class: Manip
When the mouse button is released, makeInactive() is called. The manipulator should reset its state in preparation for the next drag.

Specified by:
makeInactive in class Manip