### proscene

# Class PSAxisPlaneConstraint

- `PSConstraint`
- - `proscene.PSAxisPlaneConstraint`

`public class PSAxisPlaneConstraint`
`extends PSConstraint`

An abstract class for PSFrame PSConstraints defined by an axis or a plane.

PSAxisPlaneConstraint is an interface for (translation and/or rotation) PSConstraint that are defined by a direction. `translationConstraintType()` and `rotationConstraintType()` define how this direction should be interpreted: as an axis or as a plane normal.

The three implementations of this class: PSLocalConstraint, PSWorldConstraint and PSCameraConstraint differ by the coordinate system in which this direction is expressed.

  ## Nested Class Summary
  `class` | `PSAxisPlaneConstraint.Type` Type lists the different types of translation and rotation constraints that are available.

  ## Constructor Summary
  `PSAxisPlaneConstraint()` Default constructor.

  ## Method Summary
  `PVector` | `rotationConstraintDirection()` Returns the axis direction used by the rotation constraint.
  `PSAxisPlaneConstraint.Type` | `rotationConstraintType()` Returns the rotation constraint Type.
  `void` | `setRotationConstraint(PSAxisPlaneConstraint.Type type, PVector direction)` Simply calls `setRotationConstraintType(PSAxisPlaneConstraint.Type)` and `setRotationConstraintDirection(PVector)`.
  `void` | `setRotationConstraintDirection(PVector direction)` Defines the `rotationConstraintDirection()`.
  `void` | `setRotationConstraintType(PSAxisPlaneConstraint.Type type)` Set the Type of the `rotationConstraintType()`.
  `void` | `setTranslationConstraint(PSAxisPlaneConstraint.Type type, PVector direction)` Simply calls `setTranslationConstraintType(PSAxisPlaneConstraint.Type)` and `setTranslationConstraintDirection(PVector)`.
  `void` | `setTranslationConstraintDirection(PVector direction)` Defines the `translationConstraintDirection()`.
  `void` | `setTranslationConstraintType(PSAxisPlaneConstraint.Type type)` Sets the Type() of the `translationConstraintType()`.
  `PVector` | `translationConstraintDirection()` Returns the direction used by the translation constraint.
  `PSAxisPlaneConstraint.Type` | `translationConstraintType()` Returns the translation constraint Type.

## Constructor Details

### PSAxisPlaneConstraint

    public PSAxisPlaneConstraint()

> Default constructor.

> `translationConstraintType()` and `rotationConstraintType()` are set to `PSAxisPlaneConstraint.Type`. `translationConstraintDirection()` and `rotationConstraintDirection()` are set to (0,0,0).

## Method Details

### rotationConstraintDirection

    public PVector rotationConstraintDirection()

> Returns the axis direction used by the rotation constraint.

> This direction is defined only when `rotationConstraintType()` is `PSAxisPlaneConstraint.Type`.

> The PSAxisPlaneConstraint derived classes express this direction in different coordinate system (camera for PSCameraConstraint, local for PSLocalConstraint, and world for PSWorldConstraint). This value can be modified with `setRotationConstraintDirection(PVector)`.

### rotationConstraintType

    public PSAxisPlaneConstraint.Type rotationConstraintType()

> Returns the rotation constraint Type.

### setRotationConstraint

    public void setRotationConstraint(PSAxisPlaneConstraint.Type type,
                                      PVector direction)

> Simply calls `setRotationConstraintType(PSAxisPlaneConstraint.Type)` and `setRotationConstraintDirection(PVector)`.

### setRotationConstraintDirection

    public void setRotationConstraintDirection(PVector direction)

> Defines the `rotationConstraintDirection()`. The coordinate system where `direction` is expressed depends on your class implementation.

### setRotationConstraintType

    public void setRotationConstraintType(PSAxisPlaneConstraint.Type type)

> Set the Type of the `rotationConstraintType()`. Default is `PSAxisPlaneConstraint.Type`.

> Depending on this value, the PSFrame will freely rotate (`PSAxisPlaneConstraint.Type`), will only be able to rotate around an axis (`PSAxisPlaneConstraint.Type`), or will not able to rotate at all `PSAxisPlaneConstraint.Type`.

> Use `PSFrame.setOrientation(PSQuaternion)` to define the orientation of the constrained PSFrame before it gets constrained.

> Attention: An `PSAxisPlaneConstraint.Type` Type is not meaningful for rotational constraints and will be ignored.

### setTranslationConstraint

    public void setTranslationConstraint(PSAxisPlaneConstraint.Type type,
                                         PVector direction)

> Simply calls `setTranslationConstraintType(PSAxisPlaneConstraint.Type)` and `setTranslationConstraintDirection(PVector)`.

### setTranslationConstraintDirection

    public void setTranslationConstraintDirection(PVector direction)

> Defines the `translationConstraintDirection()`. The coordinate system where `direction` is expressed depends on your class implementation.

### setTranslationConstraintType

    public void setTranslationConstraintType(PSAxisPlaneConstraint.Type type)

> Sets the Type() of the `translationConstraintType()`. Default is `PSAxisPlaneConstraint.Type`

### translationConstraintDirection

    public PVector translationConstraintDirection()

> Returns the direction used by the translation constraint.

> It represents the axis direction (`PSAxisPlaneConstraint.Type`) or the plane normal (`PSAxisPlaneConstraint.Type`) depending on the `translationConstraintType()`. It is undefined for (`PSAxisPlaneConstraint.Type`) or (`PSAxisPlaneConstraint.Type`).

> The PSAxisPlaneConstraint derived classes express this direction in different coordinate system (camera for PSCameraConstraint, local for PSLocalConstraint, and world for PSWorldConstraint). This value can be modified with `setRotationConstraintDirection(PVector)`.

### translationConstraintType

    public PSAxisPlaneConstraint.Type translationConstraintType()

> Returns the translation constraint Type.

> Depending on this value, the PSFrame will freely translate (`PSAxisPlaneConstraint.Type`), will only be able to translate along an axis direction (`PSAxisPlaneConstraint.Type`), will be forced to stay into a plane (`PSAxisPlaneConstraint.Type`) or will not able to translate at all (`PSAxisPlaneConstraint.Type`).

> Use `PSFrame.setPosition(PVector)` to define the position of the constrained PSFrame before it gets constrained.

processing library glgraphics by Andres Colubri. (c) 2008