Examples of intersectsRay()


Examples of toxi.geom.AABB.intersectsRay()

    }

    public void testAABBRayIntersect() {
        AABB box = AABB.fromMinMax(new Vec3D(), new Vec3D(100, 100, 100));
        Ray3D r = new Ray3D(new Vec3D(50, 10, 10), new Vec3D(0, 1, 0));
        System.out.println(box.intersectsRay(r, -1000, 1000));
    }

    public void testAABBSphere() {
        AABB box = new AABB(new Vec3D(100, 0, 0), new Vec3D(20, 20, 20));
        Sphere s = new Sphere(new Vec3D(100, 0, 0), 50);
View Full Code Here

Examples of toxi.geom.Ray3DIntersector.intersectsRay()

        size(400, 400);
        gfx = new ToxiclibsSupport(this);
        Ray3D r = new Ray3D(new Vec3D(), new Vec3D(1, 0, 0));
        Ray3D r2 = new Ray3D(new Vec3D(10, 10, 0), new Vec3D(1, -1, 0));
        Ray3DIntersector ri = new Ray3DIntersector(r);
        ri.intersectsRay(r2);
        println(ri.getIntersectionData());
    }
}
View Full Code Here

Examples of toxi.geom.TriangleIntersector.intersectsRay()

            Vec3D c = getVertexAtCell(x2, z2);
            Vec3D d = getVertexAtCell((int) xx, z2);
            Ray3D r = new Ray3D(new Vec3D(x, 10000, z), new Vec3D(0, -1, 0));
            TriangleIntersector i = new TriangleIntersector(new Triangle3D(a,
                    b, d));
            if (i.intersectsRay(r)) {
                isec = i.getIntersectionData();
            } else {
                i.setTriangle(new Triangle3D(b, c, d));
                i.intersectsRay(r);
                isec = i.getIntersectionData();
View Full Code Here

Examples of toxi.geom.TriangleIntersector.intersectsRay()

                    b, d));
            if (i.intersectsRay(r)) {
                isec = i.getIntersectionData();
            } else {
                i.setTriangle(new Triangle3D(b, c, d));
                i.intersectsRay(r);
                isec = i.getIntersectionData();
            }
        }
        return isec;
    }
View Full Code Here

Examples of toxi.geom.TriangleIntersector.intersectsRay()

        Triangle3D tri = intersector.getTriangle();
        Vec3D[] v = null;
        for (AttributedFace f : faces) {
            v = getFaceVertices(f, v);
            tri.set(v[0], v[1], v[2]);
            if (intersector.intersectsRay(ray)) {
                return intersector.getIntersectionData();
            }
        }
        return null;
    }
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.