Package toxi.geom

Examples of toxi.geom.ReadonlyVec2D


        p.add(new Vec2D(0, 1));
        p.add(new Vec2D());
        assertEquals(4, p.getNumVertices());
        float area = p.getArea();
        assertEquals(1f, area);
        ReadonlyVec2D centroid = p.getCentroid();
        assertEquals(new Vec2D(0.5f, 0.5f), centroid);
    }
View Full Code Here


    public void testCentroid() {
        Vec2D a = new Vec2D(-100, 0);
        Vec2D b = new Vec2D(0, 100);
        Vec2D c = new Vec2D(100, 0);
        Triangle2D t = new Triangle2D(a, b, c);
        ReadonlyVec2D centroid = t.computeCentroid();
        assertTrue("incorrect centroid",
                centroid.equals(new Vec2D(0, 100).scaleSelf(1f / 3)));
    }
View Full Code Here

TOP

Related Classes of toxi.geom.ReadonlyVec2D

Copyright © 2018 www.massapicom. 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.