gnu.gleem
Class Translate2Manip

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

public class Translate2Manip
extends Manip

A Translate2Manip is a Manip which translates in two dimensions and whose default representation is two arrows.


Constructor Summary
Translate2Manip()
           
 
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 getNormal()
          Get the normal of this Translate2Manip.
 Vec3f getScale()
           
 Vec3f getTranslation()
          Get the translation of this Translate2Manip.
 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 replaceGeometry(ManipPart geom)
          Change the geometry of this manipulator to be the user-defined piece.
 void setNormal(Vec3f normal)
          Set the normal of this Translate2Manip.
 void setScale(Vec3f scale)
          Set the scale of the Translate2Manip.
 void setTranslation(Vec3f translation)
          Set the translation of this Translate2Manip.
 
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

Translate2Manip

public Translate2Manip()
Method Detail

setTranslation

public void setTranslation(Vec3f translation)
Set the translation of this Translate2Manip. This moves its on-screen representation. Manipulations cause the translation to be modified, not overwritten, so if you want the default Translate2Manip to go through the point (0, 1, 0) but still translate in the X-Z plane, then setTranslation(0, 1, 0).


getTranslation

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


setNormal

public void setNormal(Vec3f normal)
Set the normal of this Translate2Manip. The manip moves in the plane containing its current position and perpendicular to this normal. Does not need to be normalized, but must not be the zero vector.


getNormal

public Vec3f getNormal()
Get the normal of this Translate2Manip.


setScale

public void setScale(Vec3f scale)
Set the scale of the Translate2Manip. This only affects the size of the on-screen geometry.


getScale

public Vec3f getScale()

replaceGeometry

public void replaceGeometry(ManipPart geom)
Change the geometry of this manipulator to be the user-defined piece.


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

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