org.gicentre.utils.network.traer.physics

## Class Drag

- java.lang.Object
- - org.gicentre.utils.network.traer.physics.Function<Particle,Particle>
  - - org.gicentre.utils.network.traer.physics.Drag

-     public class Drag
      extends Function<Particle,Particle>

  Class capable of applying the drag on a particle to inhibit its motion.
  Version:
    3.4, 5th February, 2016.
  Author:
    Carl Pearson, Jeffrey Traer Bernstein and minor modifications by Jo Wood.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static float` | `DEFAULT_DRAG` Default drag value.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Drag()` Creates a drag with the default value.
    `Drag(float drag)` Creates a drag with the given value.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Particle` | `apply(Particle p)` Applies this drag to the given particle.
    `Drag` | `setDrag(float drag)` Sets the drag to the given value.

    - ### Methods inherited from class org.gicentre.utils.network.traer.physics.Function

      `combine, functor, transform`

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

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

- - ### Field Detail

    - #### DEFAULT_DRAG

          public static final float DEFAULT_DRAG

      Default drag value.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Drag

          public Drag()

      Creates a drag with the default value.

    - #### Drag

          public Drag(float drag)

      Creates a drag with the given value.
      Parameters:
        `drag` - Drag to apply to particles.

  - ### Method Detail

    - #### setDrag

          public Drag setDrag(float drag)

      Sets the drag to the given value.
      Parameters:
        `drag` - Drag to apply to particles.
      Returns:
        The drag with the newly modified value.

    - #### apply

          public Particle apply(Particle p)

      Applies this drag to the given particle.
      Specified by:
        `apply` in class `Function<Particle,Particle>`
      Parameters:
        `p` - Particle upon which to apply the drag.
      Returns:
        The particle with a modified velocity in response to this drag.