Package toxi.test.geom

Source Code of toxi.test.geom.PlaneTest

package toxi.test.geom;

import junit.framework.TestCase;
import toxi.geom.Plane;
import toxi.geom.Triangle3D;
import toxi.geom.Vec3D;

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));
        Vec3D proj;
        proj = plane.getProjectedPoint(new Vec3D());
        assertEquals(origin, proj);
        proj = plane.getProjectedPoint(new Vec3D(0, 200, 0));
        assertEquals(origin, proj);
        proj = plane.getProjectedPoint(origin);
        assertEquals(origin, proj);
    }
}
TOP

Related Classes of toxi.test.geom.PlaneTest

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.