Java Distance Calculate calcDistanceToStop(double startingVelocity, double maxDeceleration)

Here you can find the source of calcDistanceToStop(double startingVelocity, double maxDeceleration)

Description

Get the amount of distance it will take to stop, given a starting velocity.

License

Open Source License

Parameter

Parameter Description
startingVelocity the velocity at which the Vehicle starts decelerating
maxDeceleration the maximum deceleration

Return

the amount of distance it will take to stop

Declaration

public static double calcDistanceToStop(double startingVelocity,
        double maxDeceleration) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  w w w. j av  a  2 s.c  o m*/
     * Get the amount of distance it will take to stop, given a starting
     * velocity.
     *
     * @param startingVelocity  the velocity at which the Vehicle starts
     *                          decelerating
     * @param maxDeceleration   the maximum deceleration
     * @return the amount of distance it will take to stop
     */
    public static double calcDistanceToStop(double startingVelocity,
            double maxDeceleration) {
        // distance to stop is - v ^2 / 2 * a
        return (-1.0) * startingVelocity * startingVelocity
                / (2.0 * maxDeceleration);
    }
}

Related

  1. calcDistance(int ax, int ay, int bx, int by)
  2. calcDistance(int x1, int y1, int x2, int y2)
  3. calcDistanceBetweenCoords(double startLat, double startLon, double endLat, double endLon)
  4. calcDistanceHubery(double lat1, double lng1, double lat2, double lng2, int type)
  5. calcDistanceIfAccel(double startVelocity, double accel, double targetVelocity, double duration)
  6. calculateDistance(double lat1, double lng1, double lat2, double lng2)
  7. calculateDistance(Double lng1, Double lat1, Double lng2, Double lat2)
  8. calculateDistance(Double prevLat, Double prevLon, Double currentLat, Double currentLon)
  9. calculateDistance(double rssi, double txPower)