Package org.gephi.layout.plugin.force.quadtree

Examples of org.gephi.layout.plugin.force.quadtree.QuadTree.addNode()


    }

    @org.junit.Test
    public void testLeafTree() {
        QuadTree tree = new QuadTree(0, 0, 10, 10);
        tree.addNode(new TestNode(1, 1));
        BarnesHut barnesHut = new BarnesHut(new TestForce());

        ForceVector f = barnesHut.calculateForce(tree, tree);
        assertNotNull(f);
        assertEquals(f.x(), 1, eps);
View Full Code Here


    @org.junit.Test
    public void testMaxLevel0() {
        QuadTree tree = new QuadTree(0, 0, 10, 0);
        assertEquals(tree.mass(), 0);

        assertTrue(tree.addNode(new TestNode(1, 1)));
        assertEquals(1, tree.mass());
        assertEquals(1, tree.x(), eps);
        assertEquals(1, tree.y(), eps);

        assertTrue(tree.addNode(new TestNode(9, 9)));
View Full Code Here

        assertTrue(tree.addNode(new TestNode(1, 1)));
        assertEquals(1, tree.mass());
        assertEquals(1, tree.x(), eps);
        assertEquals(1, tree.y(), eps);

        assertTrue(tree.addNode(new TestNode(9, 9)));
        assertEquals(tree.mass(), 2);
        assertEquals(5, tree.x(), eps);
        assertEquals(5, tree.y(), eps);
    }
View Full Code Here

    @org.junit.Test
    public void testMaxLevel1() {
        QuadTree tree = new QuadTree(0, 0, 10, 1);
        assertEquals(0, tree.mass());

        assertTrue(tree.addNode(new TestNode(1, 1)));
        assertEquals(1, tree.mass());
        assertEquals(1, tree.x(), eps);
        assertEquals(1, tree.y(), eps);

        assertTrue(tree.addNode(new TestNode(9, 9)));
View Full Code Here

        assertTrue(tree.addNode(new TestNode(1, 1)));
        assertEquals(1, tree.mass());
        assertEquals(1, tree.x(), eps);
        assertEquals(1, tree.y(), eps);

        assertTrue(tree.addNode(new TestNode(9, 9)));
        assertEquals(2, tree.mass());
        assertEquals(5, tree.y(), eps);

        checkMassCenterConservation(tree);
    }
View Full Code Here

    @org.junit.Test
    public void testLevel1Leaf() {
        QuadTree tree = new QuadTree(0, 0, 10, 1);
        assertEquals(0, tree.mass());

        assertTrue(tree.addNode(new TestNode(7, 7)));
        assertTrue(tree.addNode(new TestNode(7, 8)));
        assertTrue(tree.addNode(new TestNode(8, 7)));
        assertTrue(tree.addNode(new TestNode(8, 8)));

        assertTrue(tree.addNode(new TestNode(1, 1)));
View Full Code Here

    public void testLevel1Leaf() {
        QuadTree tree = new QuadTree(0, 0, 10, 1);
        assertEquals(0, tree.mass());

        assertTrue(tree.addNode(new TestNode(7, 7)));
        assertTrue(tree.addNode(new TestNode(7, 8)));
        assertTrue(tree.addNode(new TestNode(8, 7)));
        assertTrue(tree.addNode(new TestNode(8, 8)));

        assertTrue(tree.addNode(new TestNode(1, 1)));
        checkMassCenterConservation(tree);
View Full Code Here

        QuadTree tree = new QuadTree(0, 0, 10, 1);
        assertEquals(0, tree.mass());

        assertTrue(tree.addNode(new TestNode(7, 7)));
        assertTrue(tree.addNode(new TestNode(7, 8)));
        assertTrue(tree.addNode(new TestNode(8, 7)));
        assertTrue(tree.addNode(new TestNode(8, 8)));

        assertTrue(tree.addNode(new TestNode(1, 1)));
        checkMassCenterConservation(tree);
    }
View Full Code Here

        assertEquals(0, tree.mass());

        assertTrue(tree.addNode(new TestNode(7, 7)));
        assertTrue(tree.addNode(new TestNode(7, 8)));
        assertTrue(tree.addNode(new TestNode(8, 7)));
        assertTrue(tree.addNode(new TestNode(8, 8)));

        assertTrue(tree.addNode(new TestNode(1, 1)));
        checkMassCenterConservation(tree);
    }
}
View Full Code Here

        assertTrue(tree.addNode(new TestNode(7, 7)));
        assertTrue(tree.addNode(new TestNode(7, 8)));
        assertTrue(tree.addNode(new TestNode(8, 7)));
        assertTrue(tree.addNode(new TestNode(8, 8)));

        assertTrue(tree.addNode(new TestNode(1, 1)));
        checkMassCenterConservation(tree);
    }
}
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.