TrigonometryTest.java 613 B

123456789101112131415161718192021222324
  1. package com.jme3.math;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. public class TrigonometryTest {
  5. @Test
  6. public void testVector2(){
  7. Vector2f original = new Vector2f(1, 2);
  8. Vector2f recreated = new Vector2f();
  9. float angle = original.getAngle();
  10. float length = original.length();
  11. recreated.set( FastMath.cos(angle), FastMath.sin(angle) );
  12. recreated.multLocal(length);
  13. assertEquals( original.getX(), recreated.getX(), 0.000001 );
  14. assertEquals( original.getY(), recreated.getY(), 0.000001 );
  15. }
  16. }