aim4.util

## Class MotionMath

- java.lang.Object
- - aim4.util.MotionMath

-     public class MotionMath
      extends Object

  This class provides utility functions for calculating the motion of the vehicles.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `calcDuration(double v1, double v2, double accel)` Calculate the time it takes to accelerate (or decelerate) from the initial velocity to the end velocity.
    `static double` | `calcDuration(double v1, double v2, double accel, double distance)` Calculate the time it takes to accelerate (or decelerate) from the initial velocity to the end velocity.
    `static double` | `calcEndVelocity(double v1, double accel, double dist)` Calculate the velocity after accelerating for a given distance, starting with a given velocity.

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

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

- - ### Method Detail

    - #### calcEndVelocity

          public static double calcEndVelocity(double v1,
                               double accel,
                               double dist)

      Calculate the velocity after accelerating for a given distance, starting with a given velocity.
      Parameters:
        `v1` - the initial velocity
        `accel` - the (constant) acceleration
        `dist` - the distance traveled
      Returns:
        the end velocity; Double.NaN if there is no solution

    - #### calcDuration

          public static double calcDuration(double v1,
                            double v2,
                            double accel)

      Calculate the time it takes to accelerate (or decelerate) from the initial velocity to the end velocity.
      Parameters:
        `v1` - the initial velocity
        `v2` - the end velocity
        `accel` - the acceleration
      Returns:
        the time it takes to accelerate from v1 to v2; Double.NaN if the acceleration is zero.

    - #### calcDuration

          public static double calcDuration(double v1,
                            double v2,
                            double accel,
                            double distance)

      Calculate the time it takes to accelerate (or decelerate) from the initial velocity to the end velocity. If the acceleration is zero, it uses the distance traveled to compute the time.
      Parameters:
        `v1` - the initial velocity
        `v2` - the end velocity
        `accel` - the acceleration
        `distance` - the distance traveled
      Returns:
        the time it takes to accelerate from v1 to v2; Double.NaN if both the acceleration and the initial velocity is zero.

Copyright © 2013. All rights reserved.