Search in sources :

Example 11 with Vector3

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);
}
Also used : Vector3(org.rajawali3d.math.vector.Vector3) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 12 with Vector3

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);
}
Also used : Vector3(org.rajawali3d.math.vector.Vector3) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 13 with Vector3

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);
}
Also used : Vector3(org.rajawali3d.math.vector.Vector3) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 14 with Vector3

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);
}
Also used : Vector3(org.rajawali3d.math.vector.Vector3) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 15 with Vector3

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);
}
Also used : Vector3(org.rajawali3d.math.vector.Vector3) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Aggregations

Vector3 (org.rajawali3d.math.vector.Vector3)166 SmallTest (android.test.suitebuilder.annotation.SmallTest)106 Test (org.junit.Test)106 Material (org.rajawali3d.materials.Material)9 SkeletonJoint (org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint)6 Matrix4 (org.rajawali3d.math.Matrix4)6 Object3D (org.rajawali3d.Object3D)5 BoundingBox (org.rajawali3d.bounds.BoundingBox)5 DiffuseMethod (org.rajawali3d.materials.methods.DiffuseMethod)4 Quaternion (org.rajawali3d.math.Quaternion)4 ArrayList (java.util.ArrayList)3 DirectionalLight (org.rajawali3d.lights.DirectionalLight)3 ParsingException (org.rajawali3d.loader.ParsingException)3 FileNotFoundException (java.io.FileNotFoundException)2 FloatBuffer (java.nio.FloatBuffer)2 Stack (java.util.Stack)2 BoneVertex (org.rajawali3d.animation.mesh.SkeletalAnimationChildObject3D.BoneVertex)2 BoneWeight (org.rajawali3d.animation.mesh.SkeletalAnimationChildObject3D.BoneWeight)2 BoundingSphere (org.rajawali3d.bounds.BoundingSphere)2 IBoundingVolume (org.rajawali3d.bounds.IBoundingVolume)2