Examples of TreeLeaf3DState


Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

        return new TreeTrunkState(age, radius, height, trunk3DState);
    }

    public static TreeLeafState createRandomTreeLeafState() {
        BigDecimal efficiency = UtilDataCreatorForTests.createRandomBigDecimal();
        TreeLeaf3DState leafd3DState = DisplayDataCreatorForTests.createRandomTreeLeaf3DState();
        int age = Randomizer.randomBetween(0, 100);
        BigDecimal energy = new BigDecimal(Randomizer.randomBetween(0, 100));
        BigDecimal freeEnergy = new BigDecimal(Randomizer.randomBetween(0, 50));
        return new TreeLeafState(age, energy, freeEnergy, efficiency, leafd3DState);
    }
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

    public static TreeLeafState createSpecificTreeLeafState() {
        BigDecimal efficiency = PercentHelper.getDecimalValue(80);
        int age = 15;
        BigDecimal energy = new BigDecimal(10);
        BigDecimal freeEnergy = new BigDecimal(3);
        TreeLeaf3DState leafd3DState = DisplayDataCreatorForTests.createSpecificTreeLeaf3DState();
        return new TreeLeafState(age, energy, freeEnergy, efficiency, leafd3DState);
    }
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

    }

    public void testCreateRandom() {
        Point3d leafAttachPoint = new Point3d(Math.random(), Math.random(), Math.random());
        TreeLeaf leaf = factory.createRandom(leafAttachPoint);
        TreeLeaf3DState leaf3dState = leaf.getTreeLeaf3D().getState();
        // test the leaf created is a random one (by testing the 3d leaf)
        Point3dState initialEndPoint1 = leaf3dState.getInitialEndPoint1();
        Point3dState initialEndPoint2 = leaf3dState.getInitialEndPoint2();
        Point3dState expectedEndPoint1 = new Point3dState(initialEndPoint1.getX() * 10, initialEndPoint1.getY() * 10,
                initialEndPoint1.getZ() * 10);
        Point3dState expectedEndPoint2 = new Point3dState(initialEndPoint2.getX() * 10, initialEndPoint2.getY() * 10,
                initialEndPoint2.getZ() * 10);
        assertEquals(expectedEndPoint1, leaf3dState.getEndPoint1());
        assertEquals(expectedEndPoint2, leaf3dState.getEndPoint2());
    }
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

    public void testCreateNew() {
        Point3d leafAttachPoint = new Point3d(Math.random(), Math.random(), Math.random());
        BigDecimal energy = new BigDecimal(30);
        TreeLeaf leaf = factory.createNew(leafAttachPoint, energy);
        assertEquals(energy, leaf.getEnergy());
        TreeLeaf3DState leaf3dState = leaf.getTreeLeaf3D().getState();
        // test the leaf created is a new one (by testing the 3d leaf)
        assertEquals(leaf3dState.getInitialEndPoint1(), leaf3dState.getEndPoint1());
        assertEquals(leaf3dState.getInitialEndPoint2(), leaf3dState.getEndPoint2());
    }
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

        assertEquals("no leaf should have been removed", nbLeaves - 1, branchPart.getNbLeaves());
    }

    public void testComputeAttachPointForNewLeaf1() {
        // create object states
        TreeLeaf3DState leaf3D1 = new TreeLeaf3DState();
        leaf3D1.setLeafAttachPoint(new Point3dState(2, 0, 0));
        TreeLeaf3DState leaf3D2 = new TreeLeaf3DState();
        leaf3D2.setLeafAttachPoint(new Point3dState(3, 0, 0));
        TreeLeafState leaf1 = new TreeLeafState();
        leaf1.setLeaf3DState(leaf3D1);
        TreeLeafState leaf2 = new TreeLeafState();
        leaf2.setLeaf3DState(leaf3D2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

        PointTestHelper.assertPointIsWithinBounds(pointForNewLeaf, boundsStartPoint, boundsEndPoint);
    }

    public void testComputeAttachPointForNewLeaf2() {
        // create object states
        TreeLeaf3DState leaf3D1 = new TreeLeaf3DState();
        leaf3D1.setLeafAttachPoint(new Point3dState(1, 0, 0));
        TreeLeaf3DState leaf3D2 = new TreeLeaf3DState();
        leaf3D2.setLeafAttachPoint(new Point3dState(5, 0, 0));
        TreeLeafState leaf1 = new TreeLeafState();
        leaf1.setLeaf3DState(leaf3D1);
        TreeLeafState leaf2 = new TreeLeafState();
        leaf2.setLeaf3DState(leaf3D2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

        PointTestHelper.assertPointIsWithinBounds(pointForNewLeaf, boundsStartPoint, boundsEndPoint);
    }

    public void testComputeAttachPointForNewLeaf3() {
        // create object states
        TreeLeaf3DState leaf3D1 = new TreeLeaf3DState();
        leaf3D1.setLeafAttachPoint(new Point3dState(2, 0, 0));
        TreeLeaf3DState leaf3D2 = new TreeLeaf3DState();
        leaf3D2.setLeafAttachPoint(new Point3dState(3, 0, 0));
        TreeLeafState leaf1 = new TreeLeafState();
        leaf1.setLeaf3DState(leaf3D1);
        TreeLeafState leaf2 = new TreeLeafState();
        leaf2.setLeaf3DState(leaf3D2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

    /**
     * Test if the leaves are not created in the order based on the distance to the branch part start.
     */
    public void testComputeAttachPointForNewLeaf4() {
        // create object states
        TreeLeaf3DState leaf3D1 = new TreeLeaf3DState();
        leaf3D1.setLeafAttachPoint(new Point3dState(2, 0, 0));
        TreeLeaf3DState leaf3D2 = new TreeLeaf3DState();
        leaf3D2.setLeafAttachPoint(new Point3dState(3, 0, 0));
        TreeLeafState leaf1 = new TreeLeafState();
        leaf1.setLeaf3DState(leaf3D1);
        TreeLeafState leaf2 = new TreeLeafState();
        leaf2.setLeaf3DState(leaf3D2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertTrue(part.canIncreaseOneLeafSize());

        // set all the leaves at their maximum size, so that they can not be increased anymore
        for (TreeLeafState leafState : partState.getLeaveStates()) {
            TreeLeaf3DState leaf3dState = leafState.getLeaf3DState();
            Point3dState initialEndPoint1 = leaf3dState.getInitialEndPoint1();
            leaf3dState.setEndPoint1(new Point3dState(initialEndPoint1.getX() * 10, initialEndPoint1.getY() * 10,
                    initialEndPoint1.getZ() * 10));
            Point3dState initialEndPoint2 = leaf3dState.getInitialEndPoint2();
            leaf3dState.setEndPoint2(new Point3dState(initialEndPoint2.getX() * 10, initialEndPoint2.getY() * 10,
                    initialEndPoint2.getZ() * 10));
        }
        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertFalse(part.canIncreaseOneLeafSize());

View Full Code Here

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState

    public void testIncreaseOneLeafSize() {
        Point3d firstInitialEndPoint1 = firstLeafState.getLeaf3DState().getInitialEndPoint1().toPointValue();
        branchPartState.setEnergy(new BigDecimal(150));
        // set all the leaves at their maximum size, so that they can not be increased anymore
        for (TreeLeafState leafState : branchPartState.getLeaveStates()) {
            TreeLeaf3DState leaf3dState = leafState.getLeaf3DState();
            Point3dState initialEndPoint1 = leaf3dState.getInitialEndPoint1();
            leaf3dState.setEndPoint1(new Point3dState(initialEndPoint1.getX() * 10, initialEndPoint1.getY() * 10,
                    initialEndPoint1.getZ() * 10));
            Point3dState initialEndPoint2 = leaf3dState.getInitialEndPoint2();
            leaf3dState.setEndPoint2(new Point3dState(initialEndPoint2.getX() * 10, initialEndPoint2.getY() * 10,
                    initialEndPoint2.getZ() * 10));
        }
        // set the first leaf end point to (0,0,0) so that it can be increased
        firstLeafState.getLeaf3DState().setEndPoint1(new Point3dState());
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), branchPartState);
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.