create changelog entry
[debian/openrocket] / core / test / net / sf / openrocket / util / Rotation2DTest.java
1 package net.sf.openrocket.util;
2
3 import static org.junit.Assert.assertEquals;
4
5 import org.junit.Test;
6
7 public class Rotation2DTest {
8         
9         @Test
10         public void rotationTest() {
11                 
12                 double rot60 = 0.5;
13                 double rot30 = Math.sqrt(3)/2;
14                 
15                 Coordinate x = new Coordinate(1,1,0);
16                 Coordinate y = new Coordinate(0,1,1);
17                 
18                 Rotation2D rot = new Rotation2D(Math.PI/3);  // 60 deg
19                 
20                 assertEquals(new Coordinate(rot60, 1, -rot30), rot.rotateY(x));
21                 assertEquals(new Coordinate(rot60, 1, rot30), rot.invRotateY(x));
22                 
23                 assertEquals(new Coordinate(1, rot60, rot30), rot.rotateX(x));
24                 assertEquals(new Coordinate(1, rot60, -rot30), rot.invRotateX(x));
25                 
26                 assertEquals(new Coordinate(-rot30, rot60, 1), rot.rotateZ(y));
27                 assertEquals(new Coordinate(rot30, rot60, 1), rot.invRotateZ(y));
28                 
29         }
30
31 }