-
Notifications
You must be signed in to change notification settings - Fork 0
/
Velocity.java
35 lines (33 loc) · 868 Bytes
/
Velocity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Class representing the velocity vector
*
* @author Austin
* @version 0
*/
public class Velocity extends Vector {
/**
* Constructor for Velocity with starting values
*
* @param x The x component of velocity
* @param y The y component of velocity
*/
public Velocity(double x, double y) {
super(x, y);
}
/**
* Constructor for a 0 Velocity
*/
public Velocity() {
super(0, 0);
}
/**
* Updates the velocity with an acceleration over some time
*
* @param acceleration The accleration of the object with the velocity
* @param dt The time since the last update
*/
public void updateWithAcceleration(Acceleration acceleration, double dt) {
x += acceleration.getX() * dt;
y += acceleration.getY() * dt;
}
}