1
0
Fork 0
This commit is contained in:
Moritz Henseleit 2019-11-22 15:56:57 +01:00
parent 094d23b9ba
commit 3d74d9e5e0
1 changed files with 1 additions and 1 deletions

View File

@ -73,7 +73,7 @@ public class Vector2D implements IVector2D {
*/
public void rescale() {
// calc unit vector and set it
double vectorlength = Math.sqrt(Math.pow(getDx(), 2) + Math.pow(getDy(), 2));
double vectorlength = Math.sqrt(Math.pow(getDx(), 2) + Math.pow(getDy(), 2)); //using the square root of x and y
setDx((1/vectorlength) * getDx() * Constants.BALL_SPEED);
setDy((1/vectorlength) * getDy() * Constants.BALL_SPEED);
}