Package toxi.geom

Examples of toxi.geom.Triangle2D.computeCentroid()


    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)));
    }

    public void testClockwise() {
View Full Code Here


    }

    public void testEquilateral() {
        Triangle2D t = Triangle2D.createEquilateralFrom(new Vec2D(-100, 0),
                new Vec2D(100, 0));
        assertEquals(new Vec2D(0, -57.735027f), t.computeCentroid());
    }

    public void testIntersection() {
        Vec2D a = new Vec2D(-100, 0);
        Vec2D b = new Vec2D(0, -100);
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.