Package toxi.geom

Examples of toxi.geom.Sphere


     * @param isBoundary
     *            constraint mode. Use {@linkplain #INSIDE} or
     *            {@linkplain #OUTSIDE} to specify constraint behaviour.
     */
    public SphereConstraint(Vec3D origin, float radius, boolean isBoundary) {
        sphere = new Sphere(origin, radius);
        this.isBoundingSphere = isBoundary;
    }
View Full Code Here


        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);
        assertEquals(box.intersectsSphere(s), true);
    }
View Full Code Here

        float radius = 0;
        computeCentroid();
        for (Vertex v : vertices.values()) {
            radius = MathUtils.max(radius, v.distanceToSquared(centroid));
        }
        return new Sphere(centroid, (float) Math.sqrt(radius));
    }
View Full Code Here

public class SphereTest extends TestCase {

    public void testIsInSphere() {
        Vec3D p = new Vec3D(0, -10, 0);
        Sphere s = new Sphere(new Vec3D(), 10);
        assertEquals(s.containsPoint(p), true);
        p.set(0, 10.1f, 0);
        assertEquals(s.containsPoint(p), false);
    }
View Full Code Here

    }

    public void testSurfaceDistance() {
        Vec2D p = new Vec2D(90, 60).scale(MathUtils.DEG2RAD);
        Vec2D q = new Vec2D(90, 61).scale(MathUtils.DEG2RAD);
        Sphere e = new Sphere(Sphere.EARTH_RADIUS);
        double dist = (float) e.surfaceDistanceBetween(p, q);
        assertTrue(MathUtils.abs(dist - 111.1952) < 0.1);
    }
View Full Code Here

     * world origin.
     *
     * @param radius
     */
    public SphereFunction(float radius) {
        this(new Sphere(new Vec3D(), radius));
    }
View Full Code Here

        PointOctree leaf1 = t.getLeafForPoint(new Vec3D(0, 0, 0));
        PointOctree leaf2 = t.getLeafForPoint(new Vec3D(1, 0, 0));
        assertNotSame(leaf1, leaf2);
        assertEquals(t.addPoint(new Vec3D(0, 100, 0)), true);
        assertEquals(t.addPoint(new Vec3D(101, 0, 0)), false);
        List<Vec3D> points = t.getPointsWithinSphere(new Sphere(new Vec3D(50,
                0, 0), 50));
        assertEquals(points.size() == 2, true);
        points = t.getPointsWithinBox(new AABB(new Vec3D(50, 50, 50),
                new Vec3D(50, 50, 50)));
        assertEquals(points.size() == 3, true);
View Full Code Here

            test.box = new AABB();
            test.plane = new Plane();
            test.quat = new Quaternion(0, Vec3D.X_AXIS);
            test.ray = new Ray3D();
            test.rect = new Rect(0, 0, 100, 200);
            test.sphere = new Sphere();
            test.tri = new Triangle3D(new Vec3D(), new Vec3D(), new Vec3D());
            List<Vec2D> points2d = new ArrayList<Vec2D>();
            points2d.add(new Vec2D());
            points2d.add(new Vec2D());
            points2d.add(new Vec2D());
View Full Code Here

TOP

Related Classes of toxi.geom.Sphere

Copyright © 2018 www.massapicom. 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.