use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testRotateY.
@Test
public void testRotateY() throws Exception {
final Vector3 v1 = new Vector3(Vector3.X);
final Vector3 v2 = new Vector3(Vector3.Y);
final Vector3 v3 = new Vector3(Vector3.Z);
v1.rotateY(Math.PI);
v2.rotateY(Math.PI);
v3.rotateY(Math.PI / 2.0);
assertEquals(Vector3.Y.x, v2.x, 0);
assertEquals(Vector3.Y.y, v2.y, 0);
assertEquals(Vector3.Y.z, v2.z, 0);
assertEquals(Vector3.NEG_X.x, v1.x, 1e-14);
assertEquals(Vector3.NEG_X.y, v1.y, 1e-14);
assertEquals(Vector3.NEG_X.z, v1.z, 1e-14);
assertEquals(Vector3.X.x, v3.x, 1e-14);
assertEquals(Vector3.X.y, v3.y, 1e-14);
assertEquals(Vector3.X.z, v3.z, 1e-14);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testConstructorNoArgs.
@Test
public void testConstructorNoArgs() throws Exception {
final Vector3 v = new Vector3();
assertNotNull(v);
assertEquals(0, v.x, 0);
assertEquals(0, v.y, 0);
assertEquals(0, v.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testDivideFromVector3.
@Test
public void testDivideFromVector3() throws Exception {
final Vector3 u = new Vector3(1d, 2d, 3d);
final Vector3 v = new Vector3(0.5d, 0.25d, 4d);
final Vector3 out = u.divide(v);
assertNotNull(out);
assertTrue(out == u);
assertEquals(2d, u.x, 0);
assertEquals(8d, u.y, 0);
assertEquals(0.75d, u.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testSubtractAndSet.
@Test
public void testSubtractAndSet() throws Exception {
final Vector3 u = new Vector3(1.1d, 2.2d, 3.3d);
final Vector3 v = new Vector3(0.1d, 0.2d, 0.3d);
final Vector3 t = new Vector3();
final Vector3 out = t.subtractAndSet(u, v);
assertNotNull(out);
assertTrue(out == t);
assertEquals(1d, t.x, 0);
assertEquals(2d, t.y, 0);
assertEquals(3d, t.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testMultiplyAndCreateFromVector3Double.
@Test
public void testMultiplyAndCreateFromVector3Double() throws Exception {
final Vector3 v1 = new Vector3(1d, 2d, 3d);
final Vector3 v = Vector3.multiplyAndCreate(v1, 2d);
assertNotNull(v);
assertEquals(2d, v.x, 0);
assertEquals(4d, v.y, 0);
assertEquals(6d, v.z, 0);
}
Aggregations