use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testConstructorFromDoubleArray.
@Test
public void testConstructorFromDoubleArray() throws Exception {
final double[] values = new double[] { 1d, 2d, 3d };
final Vector3 v = new Vector3(values);
assertNotNull(v);
assertEquals(1d, v.x, 0);
assertEquals(2d, v.y, 0);
assertEquals(3d, v.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testMultiplyFromVector3.
@Test
public void testMultiplyFromVector3() throws Exception {
final Vector3 v = new Vector3(1d, 2d, 3d);
final Vector3 v1 = new Vector3(2d, 3d, 4d);
final Vector3 out = v.multiply(v1);
assertNotNull(out);
assertTrue(out == v);
assertEquals(2d, v.x, 0);
assertEquals(6d, v.y, 0);
assertEquals(12d, v.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testConstructorFromVector3.
@Test
public void testConstructorFromVector3() throws Exception {
final Vector3 v1 = new Vector3(2d);
final Vector3 v = new Vector3(v1);
assertNotNull(v);
assertEquals(2d, v.x, 0);
assertEquals(2d, v.y, 0);
assertEquals(2d, v.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testAddVector3.
@Test
public void testAddVector3() throws Exception {
final Vector3 u = new Vector3(1d, 2d, 3d);
final Vector3 v = new Vector3(0.1d, 0.2d, 0.3d);
final Vector3 out = u.add(v);
assertNotNull(out);
assertTrue(out == u);
assertEquals(1.1d, u.x, 0);
assertEquals(2.2d, u.y, 0);
assertEquals(3.3d, u.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testAngle.
@Test
public void testAngle() throws Exception {
final Vector3 v1 = new Vector3(Vector3.X);
final Vector3 v2 = new Vector3(Vector3.Y);
final Vector3 v = new Vector3(1d, 1d, 1d);
final double angle1 = v1.angle(v2);
final double angle2 = v2.angle(v1);
assertEquals(90d, angle1, 0d);
assertEquals(90d, angle2, 0d);
assertEquals(54.735610317245346, v.angle(Vector3.X), 1e-14);
assertEquals(54.735610317245346, v.angle(Vector3.Y), 1e-14);
assertEquals(54.735610317245346, v.angle(Vector3.Z), 1e-14);
}
Aggregations