Examples of fromBarycentric()


Examples of toxi.geom.Triangle2D.fromBarycentric()

        Triangle2D t = new Triangle2D(a, b, c);
        assertEquals(new Vec3D(1, 0, 0), t.toBarycentric(a));
        assertEquals(new Vec3D(0, 1, 0), t.toBarycentric(b));
        assertEquals(new Vec3D(0, 0, 1), t.toBarycentric(c));
        // test roundtrip
        assertEquals(a, t.fromBarycentric(t.toBarycentric(a)));
        assertEquals(b, t.fromBarycentric(t.toBarycentric(b)));
        assertEquals(c, t.fromBarycentric(t.toBarycentric(c)));
        Vec2D p = new Vec2D(0, 0);
        assertEquals(p, t.fromBarycentric(t.toBarycentric(p)));
        // test point outside
View Full Code Here

Examples of toxi.geom.Triangle2D.fromBarycentric()

        assertEquals(new Vec3D(1, 0, 0), t.toBarycentric(a));
        assertEquals(new Vec3D(0, 1, 0), t.toBarycentric(b));
        assertEquals(new Vec3D(0, 0, 1), t.toBarycentric(c));
        // test roundtrip
        assertEquals(a, t.fromBarycentric(t.toBarycentric(a)));
        assertEquals(b, t.fromBarycentric(t.toBarycentric(b)));
        assertEquals(c, t.fromBarycentric(t.toBarycentric(c)));
        Vec2D p = new Vec2D(0, 0);
        assertEquals(p, t.fromBarycentric(t.toBarycentric(p)));
        // test point outside
        Vec3D bp = t.toBarycentric(new Vec2D(0, -150));
View Full Code Here

Examples of toxi.geom.Triangle2D.fromBarycentric()

        assertEquals(new Vec3D(0, 1, 0), t.toBarycentric(b));
        assertEquals(new Vec3D(0, 0, 1), t.toBarycentric(c));
        // test roundtrip
        assertEquals(a, t.fromBarycentric(t.toBarycentric(a)));
        assertEquals(b, t.fromBarycentric(t.toBarycentric(b)));
        assertEquals(c, t.fromBarycentric(t.toBarycentric(c)));
        Vec2D p = new Vec2D(0, 0);
        assertEquals(p, t.fromBarycentric(t.toBarycentric(p)));
        // test point outside
        Vec3D bp = t.toBarycentric(new Vec2D(0, -150));
        assertTrue(bp.magnitude() > 1);
View Full Code Here

Examples of toxi.geom.Triangle2D.fromBarycentric()

        // test roundtrip
        assertEquals(a, t.fromBarycentric(t.toBarycentric(a)));
        assertEquals(b, t.fromBarycentric(t.toBarycentric(b)));
        assertEquals(c, t.fromBarycentric(t.toBarycentric(c)));
        Vec2D p = new Vec2D(0, 0);
        assertEquals(p, t.fromBarycentric(t.toBarycentric(p)));
        // test point outside
        Vec3D bp = t.toBarycentric(new Vec2D(0, -150));
        assertTrue(bp.magnitude() > 1);
    }
View Full Code Here

Examples of toxi.geom.Triangle3D.fromBarycentric()

        Vec3D c = new Vec3D(100, 0, 0);
        Vec3D b = new Vec3D(-100, 100, 0);
        Triangle3D t = new Triangle3D(a, b, c);
        assertTrue(a.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(a)),
                0.01f));
        assertTrue(b.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(b)),
                0.01f));
        assertTrue(c.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(c)),
                0.01f));
    }
View Full Code Here

Examples of toxi.geom.Triangle3D.fromBarycentric()

        Triangle3D t = new Triangle3D(a, b, c);
        assertTrue(a.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(a)),
                0.01f));
        assertTrue(b.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(b)),
                0.01f));
        assertTrue(c.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(c)),
                0.01f));
    }

    public void testCentroid() {
        Vec3D a = new Vec3D(100, 0, 0);
View Full Code Here

Examples of toxi.geom.Triangle3D.fromBarycentric()

    public void testBarycentric() {
        Vec3D a = new Vec3D(-100, -100, 0);
        Vec3D c = new Vec3D(100, 0, 0);
        Vec3D b = new Vec3D(-100, 100, 0);
        Triangle3D t = new Triangle3D(a, b, c);
        assertTrue(a.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(a)),
                0.01f));
        assertTrue(b.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(b)),
                0.01f));
        assertTrue(c.equalsWithTolerance(t.fromBarycentric(t.toBarycentric(c)),
                0.01f));
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.