### proscene

# Class PSConstraint

- `java.lang.Object`
- - `proscene.PSConstraint`

`public class PSConstraint`
`extends java.lang.Object`

An interface class for Frame constraints.

This class defines the interface for the PSConstraints that can be applied to a PSFrame to limit its motion. Use `PSFrame.setConstraint(PSConstraint)` to associate a PSConstraint to a PSFrame (default is a `null` `PSFrame.constraint()`.

  ## Method Summary
  `PSQuaternion` | `constrainRotation(PSQuaternion rotation, PSFrame frame)` Filters the rotation applied to the `frame`.
  `PVector` | `constrainTranslation(PVector translation, PSFrame frame)` Filters the translation applied to the PSframe.

## Method Details

### constrainRotation

    public PSQuaternion constrainRotation(PSQuaternion rotation,
                                          PSFrame frame)

> Filters the rotation applied to the `frame`. This default implementation is empty (no filtering).

> Overload this method in your own PSConstraint class to define a new rotation constraint. See `constrainTranslation(PVector,PSFrame)` for details.

> Use `PSFrame.inverseTransformOf(PVector)` on the `rotation` `PSQuaternion.axis()` to express `rotation` in the world coordinate system if needed.

### constrainTranslation

    public PVector constrainTranslation(PVector translation,
                                        PSFrame frame)

> Filters the translation applied to the PSframe. This default implementation is empty (no filtering).

> Overload this method in your own PSConstraint class to define a new translation constraint. `frame` is the PSFrame to which is applied the translation. Use its `PSFrame.position()` and update the translation accordingly instead.

> `translation` is expressed in the local PSFrame coordinate system. Use `PSFrame.inverseTransformOf(PVector)` to express it in the world coordinate system if needed.

processing library glgraphics by Andres Colubri. (c) 2008