Examples of computeCentroid()


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

Examples of toxi.geom.Triangle2D.computeCentroid()

    }

    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

Examples of toxi.geom.Triangle3D.computeCentroid()

    public void testCentroid() {
        Vec3D a = new Vec3D(100, 0, 0);
        Vec3D b = new Vec3D(0, 100, 0);
        Vec3D c = new Vec3D(0, 0, 100);
        Triangle3D t = new Triangle3D(a, b, c);
        ReadonlyVec3D centroid = t.computeCentroid();
        assertTrue("incorrect centroid",
                centroid.equals(new Vec3D(100, 100, 100).scaleSelf(1f / 3)));
    }

    public void testClockwise() {
View Full Code Here

Examples of toxi.geom.Triangle3D.computeCentroid()

        Vec3D c = new Vec3D(0, 0, 100);
        Triangle3D t = new Triangle3D(a, b, c);
        assertTrue(t.containsPoint(a));
        assertTrue(t.containsPoint(b));
        assertTrue(t.containsPoint(c));
        assertTrue(t.containsPoint(t.computeCentroid()));
        assertFalse(t.containsPoint(a.add(0.1f, 0, 0)));
        t.flipVertexOrder();
        assertTrue(t.containsPoint(t.computeCentroid()));
    }
View Full Code Here

Examples of toxi.geom.Triangle3D.computeCentroid()

        assertTrue(t.containsPoint(b));
        assertTrue(t.containsPoint(c));
        assertTrue(t.containsPoint(t.computeCentroid()));
        assertFalse(t.containsPoint(a.add(0.1f, 0, 0)));
        t.flipVertexOrder();
        assertTrue(t.containsPoint(t.computeCentroid()));
    }

    public void testEquilateral() {
        Triangle3D t = Triangle3D.createEquilateralFrom(new Vec3D(-100, 0, 0),
                new Vec3D(100, 0, 0));
View Full Code Here

Examples of toxi.geom.Triangle3D.computeCentroid()

public class PlaneTest extends TestCase {

    public void testContainment() {
        Triangle3D t = new Triangle3D(new Vec3D(-100, 0, 0), new Vec3D(0, 0,
                -100), new Vec3D(0, 0, 100));
        Plane pl = new Plane(t.computeCentroid(), t.computeNormal());
    }

    public void testProjection() {
        Vec3D origin = new Vec3D(0, 100, 0);
        Plane plane = new Plane(origin, new Vec3D(0, 1, 0));
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.