use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testMultiplyFromDouble.
@Test
public void testMultiplyFromDouble() throws Exception {
final Vector3 v = new Vector3(1d, 2d, 3d);
final Vector3 out = v.multiply(2d);
assertNotNull(out);
assertTrue(out == v);
assertEquals(2d, v.x, 0);
assertEquals(4d, v.y, 0);
assertEquals(6d, v.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testZero.
@Test
public void testZero() {
final Vector3 zero = Vector3.ZERO;
assertNotNull(zero);
assertEquals(0, zero.x, 0);
assertEquals(0, zero.y, 0);
assertEquals(0, zero.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testInverse.
@Test
public void testInverse() throws Exception {
final Vector3 v = new Vector3(1d, 2d, 3d);
final Vector3 out = v.inverse();
assertNotNull(out);
assertTrue(out == 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 testAbsoluteValue.
@Test
public void testAbsoluteValue() throws Exception {
final Vector3 v = new Vector3(-0d, -1d, -2d);
final Vector3 out = v.absoluteValue();
assertNotNull(out);
assertTrue(out == v);
assertEquals(0d, v.x, 0);
assertEquals(1d, v.y, 0);
assertEquals(2d, v.z, 0);
}
use of org.rajawali3d.math.vector.Vector3 in project Rajawali by Rajawali.
the class Vector3Test method testDistanceTo2FromTwoVector3.
@Test
public void testDistanceTo2FromTwoVector3() throws Exception {
final Vector3 v1 = new Vector3(0d, 1d, 2d);
final Vector3 v2 = new Vector3(3d, 5d, 7d);
final double distance1 = Vector3.distanceTo2(v1, v2);
final double distance2 = Vector3.distanceTo2(v2, v1);
assertEquals(50d, distance1, 0);
assertEquals(50d, distance2, 0);
}
Aggregations