public class VehicleUtil extends Object
Modifier and Type | Method and Description |
---|---|
static double |
calcDistanceIfAccel(double startVelocity,
double accel,
double targetVelocity,
double duration)
Determine how far the Vehicle will go in the given duration, if
it starts at the given starting velocity and accelerates at the given
acceleration toward the provided target velocity.
|
static double |
calcDistanceToStop(double startingVelocity,
double maxDeceleration)
Get the amount of distance it will take to stop, given a starting
velocity.
|
static double |
distanceToCarInFront(AutoVehicleDriverView vehicle)
Calculate the distance to the Vehicle in front of this one, in meters.
|
static double |
distanceToChangeBetween(double v0,
double vf,
double acc)
Calculate how much distance the Vehicle will cover while changing
velocity.
|
static double |
distanceToChangeBetween(double v0,
double vf,
double acc,
double dec)
Calculate how much distance the Vehicle will cover while changing
velocity.
|
static boolean |
intersects(VehicleSimView v,
Area area)
Determine whether the given Vehicle is currently inside an area
|
static double |
maxTurnVelocity(VehicleSpec spec,
Lane arrivalLane,
Lane departureLane,
IntersectionManager im)
Get the maximum velocity that this Vehicle should make the
turn between lanes through an intersection.
|
static double |
maxVelocityToStopOverDistance(VehicleSpec spec,
double distance)
Calculate the maximum starting velocity for which the vehicle can stop
within the given distance.
|
static double |
minimumTimeToCover(double distance,
double startVelocity,
double topVelocity,
double acc)
Calculate the minimum amount of time, in seconds, it can take for the
vehicle to cover the indicated distance, given a starting velocity and
a top velocity allowed while covering the distance.
|
static double |
timeToChangeBetween(double v0,
double vf,
double acc)
Calculate how much time the Vehicle will cover to change velocity
with a given acceleration.
|
static double |
timeToChangeBetween(double v0,
double vf,
double acc,
double dec)
Calculate how much time the Vehicle will cover to change velocity
with a given acceleration and a given deceleration
|
public static double maxTurnVelocity(VehicleSpec spec, Lane arrivalLane, Lane departureLane, IntersectionManager im)
spec
- the vehicle's specificationarrivalLane
- the Lane from which the Vehicle is turningdepartureLane
- the Lane into which the Vehicle is turningim
- the IntersectionManager controlling the
intersection through which the Vehicle is making
the turnpublic static double maxVelocityToStopOverDistance(VehicleSpec spec, double distance)
spec
- the vehicle specificationdistance
- the distance over which the Vehicle will be changing
velocitypublic static double calcDistanceToStop(double startingVelocity, double maxDeceleration)
startingVelocity
- the velocity at which the Vehicle starts
deceleratingmaxDeceleration
- the maximum decelerationpublic static double calcDistanceIfAccel(double startVelocity, double accel, double targetVelocity, double duration)
startVelocity
- the initial velocity of the Vehicleaccel
- the acceleration of the Vehicle during this
timetargetVelocity
- the velocity at which the Vehicle will stop
acceleratingduration
- the duration for which this all takes placepublic static double timeToChangeBetween(double v0, double vf, double acc)
v0
- the initial velocity of the Vehiclevf
- the final velocity of the Vehicleacc
- the accelerationpublic static double timeToChangeBetween(double v0, double vf, double acc, double dec)
v0
- the initial velocity of the Vehiclevf
- the final velocity of the Vehicleacc
- the accelerationdec
- the decelerationpublic static double distanceToChangeBetween(double v0, double vf, double acc)
v0
- the initial velocity of the Vehiclevf
- the final velocity of the Vehicleacc
- the accelerationpublic static double distanceToChangeBetween(double v0, double vf, double acc, double dec)
v0
- the initial velocity of the Vehiclevf
- the final velocity of the Vehicleacc
- the accelerationdec
- the decelerationpublic static double minimumTimeToCover(double distance, double startVelocity, double topVelocity, double acc)
distance
- the distance to coverstartVelocity
- the velocity at the start of covering the distancetopVelocity
- the top allowed velocity while covering the distanceacc
- the accelerationpublic static boolean intersects(VehicleSimView v, Area area)
v
- the Vehiclearea
- the areapublic static double distanceToCarInFront(AutoVehicleDriverView vehicle)
vehicle
- the vehicleCopyright © 2013. All rights reserved.