1 package net.sf.openrocket.util;
3 import static org.junit.Assert.assertEquals;
7 public class Rotation2DTest {
10 public void rotationTest() {
13 double rot30 = Math.sqrt(3)/2;
15 Coordinate x = new Coordinate(1,1,0);
16 Coordinate y = new Coordinate(0,1,1);
18 Rotation2D rot = new Rotation2D(Math.PI/3); // 60 deg
20 assertEquals(new Coordinate(rot60, 1, -rot30), rot.rotateY(x));
21 assertEquals(new Coordinate(rot60, 1, rot30), rot.invRotateY(x));
23 assertEquals(new Coordinate(1, rot60, rot30), rot.rotateX(x));
24 assertEquals(new Coordinate(1, rot60, -rot30), rot.invRotateX(x));
26 assertEquals(new Coordinate(-rot30, rot60, 1), rot.rotateZ(y));
27 assertEquals(new Coordinate(rot30, rot60, 1), rot.invRotateZ(y));