Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## codeanticode.proscene
Class PSInteractiveFrame

    java.lang.Object
      codeanticode.proscene.PSFrame
          codeanticode.proscene.PSInteractiveFrame

All Implemented Interfaces:
  PSMouseGrabber, java.lang.Cloneable

Direct Known Subclasses:
  PSInteractiveCameraFrame

    public class PSInteractiveFrame

extends PSFrame
implements PSMouseGrabber, java.lang.Cloneable

A PSInteractiveFrame is a PSFrame that can be rotated and translated using the mouse.

It converts the mouse motion into a translation and an orientation updates. A PSInteractiveFrame is used to move an object in the scene. Combined with object selection, its PSMouseGrabber properties and a dynamic update of the scene, the PSInteractiveFrame introduces a great reactivity in your processing applications.

Nested Class Summary
`static class` | `PSInteractiveFrame.CoordinateSystemConvention` This enum defines the coordinate system convention which is defined as `LEFT_HANDED` by default (processing standard).

Field Summary

Fields inherited from interface codeanticode.proscene.PSMouseGrabber
`MouseGrabberPool`

Constructor Summary
`PSInteractiveFrame()` Default constructor.

Method Summary
`void` | `addInMouseGrabberPool()` Adds the PSMouseGrabber in the `mouseGrabberPool()`.
`void` | `checkIfGrabsMouse(int x, int y, PSCamera camera)` Implementation of the PSMouseGrabber main method.
`void` | `clearMouseGrabberPool()` Clears the `mouseGrabberPool()`.
`PSInteractiveFrame` | `clone()` Implementation of the clone method.
`PSInteractiveFrame.CoordinateSystemConvention` | `coordinateSystemConvention()` Returns the coordinate system convention used by this PSInteractiveFrame.
`java.util.List<PSMouseGrabber>` | `getMouseGrabberPool()` See `proscene.PSMouseGrabber#getMouseGrabberPool()`.
`boolean` | `grabsMouse()` Returns `true` when the PSMouseGrabber grabs the PScene's mouse events.
`boolean` | `isInMouseGrabberPool()` Returns `true` if the PSMouseGrabber is currently in the `mouseGrabberPool()` list.
`boolean` | `isSpinning()` Returns `true` when the PSInteractiveFrame is spinning.
`void` | `mouseDoubleClickEvent(java.awt.event.MouseEvent event, PSCamera camera)` Overloading of `proscene.PSMouseGrabber#mouseDoubleClickEvent(MouseEvent, PSCamera)`.
`static java.util.List<PSMouseGrabber>` | `mouseGrabberPool()` Static version of `getMouseGrabberPool()`.
`void` | `mouseMoveEvent(java.awt.event.MouseEvent event, PSCamera camera)` Modifies the PSInteractiveFrame according to the mouse motion.
`void` | `mousePressEvent(java.awt.event.MouseEvent event, PSCamera camera)` Initiates the PSInteractiveFrame mouse manipulation.
`void` | `mouseReleaseEvent(java.awt.event.MouseEvent event, PSCamera camera)` Stops the PSInteractiveFrame mouse manipulation.
`void` | `mouseWheelEvent(java.awt.event.MouseWheelEvent event, PSCamera camera)` Overloading of `proscene.PSMouseGrabber#mouseWheelEvent(MouseWheelEvent, PSCamera)`.
`void` | `removeFromMouseGrabberPool()` Removes the PSMouseGrabber from the `mouseGrabberPool()`.
`float` | `rotationSensitivity()` Returns the influence of a mouse displacement on the PSInteractiveFrame rotation.
`void` | `setCoordinateSystemConvention(PSInteractiveFrame.CoordinateSystemConvention c)` Defines the coordinate system convention of this PSInteractiveFrame, i.e., how mouse displacements are mapped into the virtual world.
`void` | `setGrabsMouse(boolean grabs)` Sets the `grabsMouse()` flag.
`void` | `setRotationSensitivity(float sensitivity)` Defines the `rotationSensitivity()`.
`void` | `setSpinningQuaternion(PSQuaternion spinningQuaternion)` Defines the `spinningQuaternion()`.
`void` | `setSpinningSensitivity(float sensitivity)` Defines the `spinningSensitivity()`.
`void` | `setTranslationSensitivity(float sensitivity)` Defines the `translationSensitivity()`.
`void` | `setWheelSensitivity(float sensitivity)` Defines the `wheelSensitivity()`.
`void` | `spin()` Rotates the PSInteractiveFrame by its `spinningQuaternion()`.
`PSQuaternion` | `spinningQuaternion()` Returns the incremental rotation that is applied by `spin()` to the PSInteractiveFrame orientation when it `isSpinning()`.
`float` | `spinningSensitivity()` Returns the minimum mouse speed required (at button release) to make the PSInteractiveFrame `spin()`.
`void` | `startSpinning(int updateInterval)` Starts the spinning of the PSInteractiveFrame.
`void` | `stopSpinning()` Stops the spinning motion started using `startSpinning(int)`.
`float` | `translationSensitivity()` Returns the influence of a mouse displacement on the PSInteractiveFrame translation.

Methods inherited from class codeanticode.proscene.PSFrame
`alignWithFrame, alignWithFrame, alignWithFrame, alignWithFrame, applyTransformation, constraint, coordinatesOf, coordinatesOfFrom, coordinatesOfIn, copy, fromMatrix, inverse, inverseCoordinatesOf, inverseTransformOf, localCoordinatesOf, localInverseCoordinatesOf, localInverseTransformOf, localTransformOf, matrix, orientation, position, projectOnLine, referenceFrame, rotate, rotate, rotateAroundPoint, rotateAroundPointModifyingArgument, rotateModifyingArgument, rotation, setConstraint, setOrientation, setOrientation, setOrientationWithConstraint, setPosition, setPosition, setPositionWithConstraint, setReferenceFrame, setRotation, setRotation, setRotationWithConstraint, settingAsReferenceFrameWillCreateALoop, setTranslation, setTranslation, setTranslationWithConstraint, transformOf, transformOfFrom, transformOfIn, translate, translate, translateModifyingArgument, translation, worldInverse, worldMatrix`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PSInteractiveFrame

    public PSInteractiveFrame()

  Default constructor.

  The `PSFrame.translation()` is set to (0,0,0), with an identity `PSFrame.rotation()` (0,0,0,1) (see PSFrame constructor for details). The different sensitivities are set to their default values (see `rotationSensitivity()` , `translationSensitivity()`, `spinningSensitivity()` and `wheelSensitivity()`).

Method Detail

### clone

    public PSInteractiveFrame clone()

  Implementation of the clone method.

  Calls `proscene.PSFrame#clone()` and makes a deep copy of the remaining object attributes except for `prevConstraint` (which is shallow copied).

  Overrides:
    `clone` in class `PSFrame`
  See Also:
    `proscene.PSFrame#clone()`

### coordinateSystemConvention

    public PSInteractiveFrame.CoordinateSystemConvention coordinateSystemConvention()

  Returns the coordinate system convention used by this PSInteractiveFrame.

  See Also:
    `setCoordinateSystemConvention(CoordinateSystemConvention)`

### setCoordinateSystemConvention

    public void setCoordinateSystemConvention(PSInteractiveFrame.CoordinateSystemConvention c)

  Defines the coordinate system convention of this PSInteractiveFrame, i.e., how mouse displacements are mapped into the virtual world.

  See Also:
    `coordinateSystemConvention()`

### getMouseGrabberPool

    public java.util.List<PSMouseGrabber> getMouseGrabberPool()

  See `proscene.PSMouseGrabber#getMouseGrabberPool()`.

  Specified by:
    `getMouseGrabberPool` in interface `PSMouseGrabber`
  See Also:
    `PSMouseGrabber.getMouseGrabberPool()`

### checkIfGrabsMouse

    public void checkIfGrabsMouse(int x,
                                  int y,
                                  PSCamera camera)

  Implementation of the PSMouseGrabber main method.

  The PSInteractiveFrame `grabsMouse()` when the mouse is within a 10 pixels region around its `proscene.PSCamera#projectedCoordinatesOf(PVector)` `PSFrame.position()`.

  Specified by:
    `checkIfGrabsMouse` in interface `PSMouseGrabber`

### grabsMouse

    public boolean grabsMouse()

  Returns `true` when the PSMouseGrabber grabs the PScene's mouse events.

  This flag is set with `setGrabsMouse(boolean)` by the `checkIfGrabsMouse(int, int, PSCamera)` method.

  Specified by:
    `grabsMouse` in interface `PSMouseGrabber`

### setGrabsMouse

    public void setGrabsMouse(boolean grabs)

  Sets the `grabsMouse()` flag. Normally used by `checkIfGrabsMouse(int, int, PSCamera)`.

  Specified by:
    `setGrabsMouse` in interface `PSMouseGrabber`

### isInMouseGrabberPool

    public boolean isInMouseGrabberPool()

  Returns `true` if the PSMouseGrabber is currently in the `mouseGrabberPool()` list.

  Default value is `true`. When set to `false` using `removeFromMouseGrabberPool()`, the PScene no longer `checkIfGrabsMouse(int, int, PSCamera)` on this PSMouseGrabber. Use `addInMouseGrabberPool()` to insert it back.

  Specified by:
    `isInMouseGrabberPool` in interface `PSMouseGrabber`

### addInMouseGrabberPool

    public void addInMouseGrabberPool()

  Adds the PSMouseGrabber in the `mouseGrabberPool()`.

  All created PSMouseGrabber are automatically added in the `mouseGrabberPool()` by the constructor. Trying to add a PSMouseGrabber that already `isInMouseGrabberPool()` has no effect.

  Use `removeFromMouseGrabberPool()` to remove the PSMouseGrabber from the list, so that it is no longer tested with `checkIfGrabsMouse(int, int, PSCamera)` by the PScene, and hence can no longer grab mouse focus. Use `isInMouseGrabberPool()` to know the current state of the PSMouseGrabber.

  Specified by:
    `addInMouseGrabberPool` in interface `PSMouseGrabber`

### removeFromMouseGrabberPool

    public void removeFromMouseGrabberPool()

  Removes the PSMouseGrabber from the `mouseGrabberPool()`.

  See `addInMouseGrabberPool()` for details. Removing a PSMouseGrabber that is not in `mouseGrabberPool()` has no effect.

  Specified by:
    `removeFromMouseGrabberPool` in interface `PSMouseGrabber`

### clearMouseGrabberPool

    public void clearMouseGrabberPool()

  Clears the `mouseGrabberPool()`.

  Use this method only if it is faster to clear the `mouseGrabberPool()` and then to add back a few PSMouseGrabbers than to remove each one independently. Use PScene.setMouseTracking(false) instead if you want to disable mouse grabbing.

  Specified by:
    `clearMouseGrabberPool` in interface `PSMouseGrabber`

### setRotationSensitivity

    public final void setRotationSensitivity(float sensitivity)

  Defines the `rotationSensitivity()`.

### setTranslationSensitivity

    public final void setTranslationSensitivity(float sensitivity)

  Defines the `translationSensitivity()`.

### setSpinningSensitivity

    public final void setSpinningSensitivity(float sensitivity)

  Defines the `spinningSensitivity()`.

### setWheelSensitivity

    public final void setWheelSensitivity(float sensitivity)

  Defines the `wheelSensitivity()`.

### rotationSensitivity

    public final float rotationSensitivity()

  Returns the influence of a mouse displacement on the PSInteractiveFrame rotation.

  Default value is 8.0. With an identical mouse displacement, a higher value will generate a larger rotation (and inversely for lower values). A 0.0 value will forbid PSInteractiveFrame mouse rotation (see also `PSFrame.constraint()`).

  See Also:
    `setRotationSensitivity(float)`, `translationSensitivity()`, `spinningSensitivity()`, `wheelSensitivity()`

### translationSensitivity

    public final float translationSensitivity()

  Returns the influence of a mouse displacement on the PSInteractiveFrame translation.

  Default value is 1.0. You should not have to modify this value, since with 1.0 the PSInteractiveFrame precisely stays under the mouse cursor.

  With an identical mouse displacement, a higher value will generate a larger translation (and inversely for lower values). A 0.0 value will forbid PSInteractiveFrame mouse translation (see also `PSFrame.constraint()`).

  Note: When the PSInteractiveFrame is used to move a Camera (see the PSInteractiveCameraFrame class documentation), after zooming on a small region of your scene, the camera may translate too fast. For a camera, it is the PSCamera.revolveAroundPoint() that exactly matches the mouse displacement. Hence, instead of changing the `translationSensitivity()`, solve the problem by (temporarily) setting the `proscene.PSCamera#revolveAroundPoint()` to a point on the zoomed region).

  See Also:
    `setTranslationSensitivity(float)`, `rotationSensitivity()`, `spinningSensitivity()`, `wheelSensitivity()`

### spinningSensitivity

    public final float spinningSensitivity()

  Returns the minimum mouse speed required (at button release) to make the PSInteractiveFrame `spin()`.

  See `spin()`, `spinningQuaternion()` and `startSpinning(int)` for details.

  Mouse speed is expressed in pixels per milliseconds. Default value is 0.3 (300 pixels per second). Use setSpinningSensitivity() to tune this value. A higher value will make spinning more difficult (a value of 100.0 forbids spinning in practice).

  See Also:
    `setSpinningSensitivity(float)`, `translationSensitivity()`, `rotationSensitivity()`, `wheelSensitivity()`

### isSpinning

    public final boolean isSpinning()

  Returns `true` when the PSInteractiveFrame is spinning.

  During spinning, `spin()` rotates the PSInteractiveFrame by its `spinningQuaternion()` at a frequency defined when the PSInteractiveFrame `startSpinning(int)`.

  Use `startSpinning(int)` and `stopSpinning()` to change this state. Default value is `false`.

### spinningQuaternion

    public final PSQuaternion spinningQuaternion()

  Returns the incremental rotation that is applied by `spin()` to the PSInteractiveFrame orientation when it `isSpinning()`.

  Default value is a `null` rotation (identity PSQuaternion). Use `setSpinningQuaternion(PSQuaternion)` to change this value.

  The `spinningQuaternion()` axis is defined in the PSInteractiveFrame coordinate system. You can use `proscene.PSFrame#transformOfFrom(PVector, PSFrame)` to convert this axis from an other PSFrame coordinate system.

### setSpinningQuaternion

    public final void setSpinningQuaternion(PSQuaternion spinningQuaternion)

  Defines the `spinningQuaternion()`. Its axis is defined in the PSInteractiveFrame coordinate system.

### stopSpinning

    public final void stopSpinning()

  Stops the spinning motion started using `startSpinning(int)`. `isSpinning()` will return `false` after this call.

### startSpinning

    public void startSpinning(int updateInterval)

  Starts the spinning of the PSInteractiveFrame.

  This method starts a timer that will call `spin()` every `updateInterval` milliseconds. The PSInteractiveFrame `isSpinning()` until you call `stopSpinning()`.

### spin

    public void spin()

  Rotates the PSInteractiveFrame by its `spinningQuaternion()`. Called by a timer when the PSInteractiveFrame `isSpinning()`.

### mousePressEvent

    public void mousePressEvent(java.awt.event.MouseEvent event,
                                PSCamera camera)

  Initiates the PSInteractiveFrame mouse manipulation. Overloading of `proscene.PSMouseGrabber#mousePressEvent(MouseEvent, PSCamera)`. The mouse behavior depends on which button is pressed.

  Specified by:
    `mousePressEvent` in interface `PSMouseGrabber`
  See Also:
    `mouseMoveEvent(MouseEvent, PSCamera)`, `mouseReleaseEvent(MouseEvent, PSCamera)`

### mouseMoveEvent

    public void mouseMoveEvent(java.awt.event.MouseEvent event,
                               PSCamera camera)

  Modifies the PSInteractiveFrame according to the mouse motion.

  Actual behavior depends on mouse bindings. See the PScene documentation for details.

  The `camera` is used to fit the mouse motion with the display parameters.

  Specified by:
    `mouseMoveEvent` in interface `PSMouseGrabber`
  See Also:
    `proscene.PSCamera#screenWidth()`, `proscene.PSCamera#screenHeight()`, `proscene.PSCamera#fieldOfView()`

### mouseReleaseEvent

    public void mouseReleaseEvent(java.awt.event.MouseEvent event,
                                  PSCamera camera)

  Stops the PSInteractiveFrame mouse manipulation.

  Overloading of `proscene.PSMouseGrabber#mouseReleaseEvent(MouseEvent, PSCamera)`.

  If the action was ROTATE MouseAction, a continuous spinning is possible if the speed of the mouse cursor is larger than `spinningSensitivity()` when the button is released. Press the rotate button again to stop spinning.

  Specified by:
    `mouseReleaseEvent` in interface `PSMouseGrabber`
  See Also:
    `startSpinning(int)`, `isSpinning()`

### mouseDoubleClickEvent

    public void mouseDoubleClickEvent(java.awt.event.MouseEvent event,
                                      PSCamera camera)

  Overloading of `proscene.PSMouseGrabber#mouseDoubleClickEvent(MouseEvent, PSCamera)`.

  Left button double click aligns the PSInteractiveFrame with the `camera` axis (see `PSFrame.alignWithFrame(PSFrame)`). Right button projects the PSInteractiveFrame on the `camera` view direction.

  Specified by:
    `mouseDoubleClickEvent` in interface `PSMouseGrabber`

### mouseWheelEvent

    public void mouseWheelEvent(java.awt.event.MouseWheelEvent event,
                                PSCamera camera)

  Overloading of `proscene.PSMouseGrabber#mouseWheelEvent(MouseWheelEvent, PSCamera)`.

  Using the wheel is equivalent to a ZOOM MouseAction.

  Specified by:
    `mouseWheelEvent` in interface `PSMouseGrabber`
  See Also:
    `setWheelSensitivity(float)`

### mouseGrabberPool

    public static java.util.List<PSMouseGrabber> mouseGrabberPool()

  Static version of `getMouseGrabberPool()`.

  Returns:
    `PSMouseGrabber.MouseGrabberPool`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

processing library glgraphics by Andres Colubri. (c) 2008