Package javax.vecmath

Examples of javax.vecmath.Vector3f.normalize()


        // Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(-1, 0, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);
    }

    public void testUpdateZenithAngle() {
        assertEquals(PercentHelper.getDecimalValue(25), mockSun.getRiseAngle());
View Full Code Here


        assertEquals(PercentHelper.getDecimalValue(25), mockSun.getRiseAngle());
        assertEquals(PercentHelper.getDecimalValue(50), mockSun.getZenithAngle());
        Vector3f actualDirection = new Vector3f();
        sunLight.getDirection(actualDirection);
        Vector3f expectedDirection = new Vector3f((float) Math.sqrt(2) / 2, -0.5f, -0.5f);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        mockSun.setZenithAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.zenithAngle);
        sunLight.getDirection(actualDirection);
View Full Code Here

        mockSun.setZenithAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.zenithAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f((float) Math.sqrt(2) / 2, 0f, (float) -Math.sqrt(2) / 2);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        mockSun.setZenithAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.zenithAngle);
        sunLight.getDirection(actualDirection);
View Full Code Here

        mockSun.setZenithAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.zenithAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f((float) Math.sqrt(2) / 2, -(float) Math.sqrt(2) / 2, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);
    }

    public void testGetWhiteFactor() {
        assertEquals(PercentHelper.getDecimalValue(25), mockSun.getRiseAngle());
View Full Code Here

/*     */
/* 608 */     unitToEar.x = (xformCenterEar.x - xformPosition.x);
/* 609 */     unitToEar.y = (xformCenterEar.y - xformPosition.y);
/* 610 */     unitToEar.z = (xformCenterEar.z - xformPosition.z);
/* 611 */     unitToEar.normalize();
/* 612 */     unitDirection.normalize(this.direction);
/* 613 */     float dotProduct = unitToEar.dot(unitDirection);
/* 614 */     float angle = (float)Math.acos(dotProduct);
/*     */
/* 617 */     return angle;
/*     */   }
View Full Code Here

/*     */
/* 608 */     unitToEar.x = (xformCenterEar.x - xformPosition.x);
/* 609 */     unitToEar.y = (xformCenterEar.y - xformPosition.y);
/* 610 */     unitToEar.z = (xformCenterEar.z - xformPosition.z);
/* 611 */     unitToEar.normalize();
/* 612 */     unitDirection.normalize(this.direction);
/* 613 */     float dotProduct = unitToEar.dot(unitDirection);
/* 614 */     float angle = (float)Math.acos(dotProduct);
/*     */
/* 617 */     return angle;
/*     */   }
View Full Code Here

/*     */     }
/*     */
/*  82 */     Vector3f axis = new Vector3f((float)hotspot.x, (float)hotspot.y, (float)hotspot.z);
/*     */
/*  86 */     Vector3f axis1 = new Vector3f();
/*  87 */     axis1.normalize(axis);
/*     */
/*  90 */     Vector3f normal = new Vector3f(0.0F, 1.0F, 0.0F);
/*  91 */     normal.cross(axis1, normal);
/*  92 */     if (normal.lengthSquared() < 0.5F) {
/*  93 */       normal.set(0.0F, 0.0F, 1.0F);
View Full Code Here

/*  91 */     normal.cross(axis1, normal);
/*  92 */     if (normal.lengthSquared() < 0.5F) {
/*  93 */       normal.set(0.0F, 0.0F, 1.0F);
/*  94 */       normal.cross(axis1, normal);
/*     */     }
/*  96 */     normal.normalize();
/*     */
/*  99 */     int divisions = 18;
/* 100 */     Point3f[] cap0 = new Point3f[divisions];
/* 101 */     Point3f[] cap1 = new Point3f[divisions];
/* 102 */     Vector3f[] capNormals = new Vector3f[divisions];
View Full Code Here

/* 181 */         v0.sub(vertices[(i + 1)], vertices[i]);
/* 182 */         v1.sub(vertices[(i + 2)], vertices[i]);
/*     */
/* 184 */         Vector3f n = new Vector3f();
/* 185 */         n.cross(v0, v1);
/* 186 */         n.normalize();
/*     */
/* 188 */         normals[i] = n;
/* 189 */         normals[(i + 1)] = n;
/* 190 */         normals[(i + 2)] = n;
/*     */       }
View Full Code Here

        offset.scale(2);
        spawnPos.add(offset);
        Vector3f dir = new Vector3f(camera.getViewingDirection());
        dir.y = 0;
        if (dir.lengthSquared() > 0.001f) {
            dir.normalize();
        } else {
            dir.set(Direction.FORWARD.getVector3f());
        }
        Quat4f rotation = QuaternionUtil.shortestArcQuat(Direction.FORWARD.getVector3f(), dir, new Quat4f());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.