Package toxi.geom

Examples of toxi.geom.PointQuadtree


                new Vec3D(50, 50, 50)));
        assertEquals(points.size() == 3, true);
    }

    public void testQuadtree() {
        PointQuadtree t = new PointQuadtree(null, 0, 0, 100, 100);
        assertEquals(t.index(new Vec2D(0, 0)), true);
        assertEquals(t.index(new Vec2D(1, 1)), true);
        assertEquals(t.index(new Vec2D(4, 0)), true);
        PointQuadtree leaf1 = t.findNode(new Vec2D(0, 0));
        PointQuadtree leaf2 = t.findNode(new Vec2D(4, 0));
        assertNotSame(leaf1, leaf2);
        List<Vec2D> points = t.itemsWithinRect(new Rect(0, 0, 2, 2), null);
        assertEquals(2, points.size());
    }
View Full Code Here


        gfx = new ToxiclibsSupport(this);
        physics = new VerletPhysics2D();
        physics.setDrag(0.1f);
        physics.setWorldBounds(new Rect(0, 0, width, height));
        physics.addBehavior(new GravityBehavior2D(new Vec2D(0, 0.15f)));
        physics.setIndex(new PointQuadtree(null, 0, 0, width + 1, height + 1));
        // physics.setIndex(new SpatialBins<Vec2D>(0, width, 80,
        // new CoordinateExtractor<Vec2D>() {
        //
        // public final float coordinate(Vec2D p) {
        // return p.x;
View Full Code Here

    }

    public void setup() {
        size(1280, 720, OPENGL);
        gfx = new ToxiclibsSupport(this);
        tree = new PointQuadtree(null, 0, 0, width, height);
        for (int i = 0; i < 5000; i++) {
            tree.index(new Vec2D(random(width), random(height)));
        }
    }
View Full Code Here

TOP

Related Classes of toxi.geom.PointQuadtree

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.