Package toxi.geom

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


        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

        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

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.