|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.freehep.graphics3d.ArcBall
Implements an ArcBall. The ball sits on top of the Canvas, allowing the user to grab it with the mouse and drag it to rotate the ball as well as the model shown on the canvas. The ongoing drag, as well as the outline of the ball is shown, while dragging. The resulting drag may also be shown by pressing Caps-Lock. Using the Ctrl, Shift or Ctrl+Shift keys will constrain the rotation to Camera, Body or User defined Axes. While moving the mouse and pressing the keys, the selected constraint axis will highlight. After pressing the mouse button (and a key), a rotation will start, constrained by the selected axis.
Original ArcBall C code from Ken Shoemake, Graphics Gems IV, 1993.
Constructor Summary | |
ArcBall(Component component)
Creates an ArcBall of size 0.8 to be placed on the given component |
|
ArcBall(Component component,
double size)
Creates an ArcBall of given size to be placed on the given component |
Method Summary | |
double |
getBallSize()
|
Enumeration |
getDrawables(Matrix4 m)
|
boolean |
isEnabled()
|
void |
keyPressed(KeyEvent event)
Handles the pressing of the Ctrl, Shift and Caps-Lock keys |
void |
keyReleased(KeyEvent event)
Handles the release of the Ctrl, Shift and Caps-Lock keys |
void |
keyTyped(KeyEvent event)
Ignored |
void |
mouseClicked(MouseEvent event)
Ignored |
void |
mouseDragged(MouseEvent event)
Left mouse button will update the (matrix) state of the ArcBall, and show the dragged (constraint) path. |
void |
mouseEntered(MouseEvent event)
Grabs keyboard focus |
void |
mouseExited(MouseEvent event)
Ignored |
void |
mouseMoved(MouseEvent event)
Moving the mouse will highlight (if a key is pressed) one of the constraint axes. |
void |
mousePressed(MouseEvent event)
Left mouse button will store start state of the drag, as well as showing the constraint axis if any. |
void |
mouseReleased(MouseEvent event)
Left mouse button will store and if requested show the resulting dragged arc. |
void |
setEnabled(boolean on)
enables or disables the arcball |
void |
setOtherAxis(int index,
Vector3 axis)
Sets one of the user axes. |
Matrix4 |
toMatrix()
|
Quaternion |
toQuaternion()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ArcBall(Component component)
public ArcBall(Component component, double size)
Method Detail |
public void setEnabled(boolean on)
public boolean isEnabled()
public void setOtherAxis(int index, Vector3 axis)
index
- in range 0..2axis
- public void mouseClicked(MouseEvent event)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent event)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent event)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent event)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent event)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent event)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent event)
mouseMoved
in interface MouseMotionListener
public void keyPressed(KeyEvent event)
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent event)
keyReleased
in interface KeyListener
public void keyTyped(KeyEvent event)
keyTyped
in interface KeyListener
public double getBallSize()
public Enumeration getDrawables(Matrix4 m)
public Matrix4 toMatrix()
public Quaternion toQuaternion()
|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |