mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-15 22:45:00 +01:00
better rotation mechanics
This commit is contained in:
parent
3bf79290bb
commit
35c47c50b8
10 changed files with 98 additions and 8 deletions
|
|
@ -67,7 +67,15 @@ class Vector2DTest {
|
|||
assertEquals(round(expected), round(rotated));
|
||||
}
|
||||
|
||||
|
||||
public static Vector2D round(Vector2D a){
|
||||
return new Vector2D(Math.round(a.x*10000d)/10000d, Math.round(a.y*10000d)/10000d);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getUnitVectorSimple() {
|
||||
double dir = Math.PI;
|
||||
Vector2D expected = new Vector2D(0, -1);
|
||||
assertEquals(round(expected), round(Vector2D.getUnitVector(dir)));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue