Package toxi.geom

Examples of toxi.geom.Quaternion.toAxisAngle()


    public void testCreateFromAxisAngle() {
        ReadonlyVec3D axis = new Vec3D(100, 100, 100);
        float angle = MathUtils.PI * 1.5f;
        Quaternion a = Quaternion.createFromAxisAngle(axis, angle);
        assertEquals(MathUtils.sin(-MathUtils.QUARTER_PI), a.w);
        float[] reverse = a.toAxisAngle();
        Vec3D revAxis = new Vec3D(reverse[1], reverse[2], reverse[3]);
        assertTrue(axis.getNormalized().equalsWithTolerance(revAxis, 0.01f));
        assertTrue(MathUtils.abs(angle - reverse[0]) < 0.01);
    }

View Full Code Here


    public void testEuler() {
        Quaternion q = Quaternion.createFromEuler(MathUtils.QUARTER_PI,
                MathUtils.QUARTER_PI, 0);
        System.out.println(q);
        float[] reverse = q.toAxisAngle();
        System.out.println("toAxisAngle():");
        for (float f : reverse) {
            System.out.println(f);
        }
    }
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.