org.gicentre.utils.network.traer.animation

## Class Smoother3D

- java.lang.Object
- - org.gicentre.utils.network.traer.animation.Smoother3D

- All Implemented Interfaces:
    Tickable

      public class Smoother3D
      extends java.lang.Object
      implements Tickable

  A 3D smoother for transitions towards a target over time at a rate determined by its smoothness. 3D smoothers are useful for 3D animation where three values must be transitioned together.
  Version:
    3.4, 5th February, 2016.
  Author:
    Jeffrey Traer Bernstein with Minor Modifications by Jo Wood.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Smoother3D(float smoothness)` Creates a 3D smoother with the given smoothness.
    `Smoother3D(float startX, float startY, float startZ, float smoothness)` Creates a 3D smoother with the given smoothness and start values.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `float` | `getX()` Reports the current x value of the smoother.
    `float` | `getXTarget()` Reports the target x value aimed at by this smoother at a rate determined by the smoothness.
    `float` | `getY()` Reports the current y value of the smoother.
    `float` | `getYTarget()` Reports the target y value aimed at by this smoother at a rate determined by the smoothness.
    `float` | `getZ()` Reports the current z value of the smoother.
    `float` | `getZTarget()` Reports the target z value aimed at by this smoother at a rate determined by the smoothness.
    `void` | `setSmoothness(float smoothness)` Sets the smoothness value that determines the rate of transition towards a target.
    `void` | `setTarget(float targetX, float targetY, float targetZ)` Sets the target values aimed at by the smoother.
    `void` | `setValue(float valueX, float valueY, float valueZ)` Move the smoother to the given values immediately regardless of the smoothness value.
    `void` | `setX(float valueX)` Move the smoother to the given x value immediately regardless of the smoothness value.
    `void` | `setXTarget(float targetX)` Sets the target x value aimed at by the smoother.
    `void` | `setY(float valueY)` Move the smoother to the given y value immediately regardless of the smoothness value.
    `void` | `setYTarget(float targetY)` Sets the target y value aimed at by the smoother.
    `void` | `setZ(float valueZ)` Move the smoother to the given z value immediately regardless of the smoothness value.
    `void` | `setZTarget(float targetZ)` Sets the target z value aimed at by the smoother.
    `void` | `tick()` Advances the time used by the smoother to move towards its targets.
    `float` | `x()` Deprecated. Consider using `getX()` instead for standard accessor naming.
    `float` | `y()` Deprecated. Consider using `getY()` instead for standard accessor naming.
    `float` | `z()` Deprecated. Consider using `getZ()` instead for standard accessor naming.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Smoother3D

          public Smoother3D(float smoothness)

      Creates a 3D smoother with the given smoothness.
      Parameters:
        `smoothness` - The smoothness of the transition towards a target. It is scaled between 0 and 1. A value of 0 has abrupt changes, 1 is very smooth. A value of 0.9 gives nice workable smoothness for typical animations.

    - #### Smoother3D

          public Smoother3D(float startX,
                            float startY,
                            float startZ,
                            float smoothness)

      Creates a 3D smoother with the given smoothness and start values.
      Parameters:
        `startX` - Initial x value that will move towards a target.
        `startY` - Initial y value that will move towards a target.
        `startZ` - Initial z value that will move towards a target.
        `smoothness` - The smoothness of the transition towards a target. It is scaled between 0 and 1. A value of 0 has abrupt changes, 1 is very smooth. A value of 0.9 gives nice workable smoothness for typical animations.

  - ### Method Detail

    - #### setSmoothness

          public final void setSmoothness(float smoothness)

      Sets the smoothness value that determines the rate of transition towards a target.
      Specified by:
        `setSmoothness` in interface `Tickable`
      Parameters:
        `smoothness` - The smoothness of the transition towards a target. It is scaled between 0 and 1. A value of 0 has abrupt changes, 1 is very smooth. A value of 0.9 gives nice workable smoothness for typical animations.

    - #### tick

          public final void tick()

      Advances the time used by the smoother to move towards its targets.
      Specified by:
        `tick` in interface `Tickable`

    - #### setXTarget

          public final void setXTarget(float targetX)

      Sets the target x value aimed at by the smoother.
      Parameters:
        `targetX` - X target value aimed at by the smoother.

    - #### setYTarget

          public final void setYTarget(float targetY)

      Sets the target y value aimed at by the smoother.
      Parameters:
        `targetY` - Y target value aimed at by the smoother.

    - #### setZTarget

          public final void setZTarget(float targetZ)

      Sets the target z value aimed at by the smoother.
      Parameters:
        `targetZ` - Z target value aimed at by the smoother.

    - #### getXTarget

          public final float getXTarget()

      Reports the target x value aimed at by this smoother at a rate determined by the smoothness.
      Returns:
        x target of the smoother.

    - #### getYTarget

          public final float getYTarget()

      Reports the target y value aimed at by this smoother at a rate determined by the smoothness.
      Returns:
        y target of the smoother.

    - #### getZTarget

          public final float getZTarget()

      Reports the target z value aimed at by this smoother at a rate determined by the smoothness.
      Returns:
        z target of the smoother.

    - #### setTarget

          public final void setTarget(float targetX,
                                      float targetY,
                                      float targetZ)

      Sets the target values aimed at by the smoother.
      Parameters:
        `targetX` - X target value aimed at by the smoother.
        `targetY` - Y target value aimed at by the smoother.
        `targetZ` - Z target value aimed at by the smoother.

    - #### setValue

          public final void setValue(float valueX,
                                     float valueY,
                                     float valueZ)

      Move the smoother to the given values immediately regardless of the smoothness value.
      Parameters:
        `valueX` - New x target value to jump to.
        `valueY` - New y target value to jump to.
        `valueZ` - New z target value to jump to.

    - #### setX

          public final void setX(float valueX)

      Move the smoother to the given x value immediately regardless of the smoothness value.
      Parameters:
        `valueX` - New x target value to jump to.

    - #### setY

          public final void setY(float valueY)

      Move the smoother to the given y value immediately regardless of the smoothness value.
      Parameters:
        `valueY` - New y target value to jump to.

    - #### setZ

          public final void setZ(float valueZ)

      Move the smoother to the given z value immediately regardless of the smoothness value.
      Parameters:
        `valueZ` - New z target value to jump to.

    - #### x

          @Deprecated
          public final float x()

      Deprecated. Consider using `getX()` instead for standard accessor naming.
      Reports the current x value of the smoother. This will be somewhere between the source and target x values depending on the smoothness and number of times `tick()` has been called.
      Returns:
        Current x value of the smoother.

    - #### getX

          public final float getX()

      Reports the current x value of the smoother. This will be somewhere between the source and target x values depending on the smoothness and number of times `tick()` has been called.
      Returns:
        Current x value of the smoother.

    - #### y

          @Deprecated
          public final float y()

      Deprecated. Consider using `getY()` instead for standard accessor naming.
      Reports the current y value of the smoother. This will be somewhere between the source and target y values depending on the smoothness and number of times `tick()` has been called.
      Returns:
        Current y value of the smoother.

    - #### getY

          public final float getY()

      Reports the current y value of the smoother. This will be somewhere between the source and target y values depending on the smoothness and number of times `tick()` has been called.
      Returns:
        Current y value of the smoother.

    - #### z

          @Deprecated
          public final float z()

      Deprecated. Consider using `getZ()` instead for standard accessor naming.
      Reports the current z value of the smoother. This will be somewhere between the source and target z values depending on the smoothness and number of times `tick()` has been called.
      Returns:
        Current z value of the smoother.

    - #### getZ

          public final float getZ()

      Reports the current z value of the smoother. This will be somewhere between the source and target z values depending on the smoothness and number of times `tick()` has been called.
      Returns:
        Current z value of the smoother.