Example #1
0
 public void testToArray() throws Exception {
   Common.assertEquals(
       new float[] {testFloat3.getX(), testFloat3.getY(), testFloat3.getZ()},
       testFloat3.toArray());
   Common.assertEquals(
       new float[] {otherFloat3.getX(), otherFloat3.getY(), otherFloat3.getZ()},
       otherFloat3.toArray());
 }
Example #2
0
 public void testCross() throws Exception {
   Common.assertEquals(new Float3(-1.5f, 3, -1.5f), testFloat3.cross(otherFloat3));
 }
Example #3
0
 public void testNormalised() throws Exception {
   float root5 = FloatMath.sqrt(5);
   Common.assertEquals(new Float3(0, 1f / root5, 2f / root5), testFloat3.normalised());
 }
Example #4
0
 public void testScale() throws Exception {
   Common.assertEquals(new Float3(0, 1.5f, 3), testFloat3.scale(1.5f));
 }
Example #5
0
 public void testMinus() throws Exception {
   Common.assertEquals(new Float3(-1.5f, -0.5f, 0.5f), testFloat3.minus(otherFloat3));
 }
Example #6
0
 public void testPlus() throws Exception {
   Common.assertEquals(new Float3(1.5f, 2.5f, 3.5f), testFloat3.plus(otherFloat3));
 }
Example #7
0
 public void testTranslate() throws Exception {
   Common.assertEquals(
       new Float3(1.5f, 2.5f, 3.5f),
       testFloat3.translate(otherFloat3.getX(), otherFloat3.getY(), otherFloat3.getZ()));
 }
Example #8
0
 public void testRotate() throws Exception {
   float root2 = FloatMath.sqrt(2);
   Common.assertEquals(new Float3(0, -root2 / 2, 3f / root2), testFloat3.rotate(45, 1, 0, 0));
 }