jmonkeyengine/engine/test/com/jme3/math/TrigonometryTest.java
sha..rd 0d0454f248 * Canvas is now using pbuffer workaround, allowing renderer to acquire renderer capabilities even if the canvas is not visible yet.
* Handling of context destruction is now handled individually for displays and canvases.
For canvas, this allows it to destroy the pbuffer in addition to the display.
 * VertexBuffer now has better detection for data size changes, might prevent GL errors in certain cases. NOTE: VertexBuffer.updateData() is generally more stable than VertexBuffer.setUpdateNeeded(). Refrain from using setUpdateNeeded() .. its an internal call anyway. Using it directly could cause GL errors.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7374 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-30 23:10:25 +00:00

25 lines
613 B
Java

package com.jme3.math;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class TrigonometryTest {
@Test
public void testVector2(){
Vector2f original = new Vector2f(1, 2);
Vector2f recreated = new Vector2f();
float angle = original.getAngle();
float length = original.length();
recreated.set( FastMath.cos(angle), FastMath.sin(angle) );
recreated.multLocal(length);
assertEquals( original.getX(), recreated.getX(), 0.000001 );
assertEquals( original.getY(), recreated.getY(), 0.000001 );
}
}