Package barsuift.simLife.j3d.tree

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState


    /**
     * Test with all but one leaves at their maximum sizes
     */
    public void testGetRandomLeafToIncrease3() {
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        leaf3DState1.setEndPoint1(new Tuple3dState(2, 0, 0));
        leaf3DState1.setEndPoint2(new Tuple3dState(0, 2, 0));
        leaf3DState1.setInitialEndPoint1(new Tuple3dState(0.2, 0, 0));
        leaf3DState1.setInitialEndPoint2(new Tuple3dState(0, 0.2, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        leaf3DState2.setEndPoint1(new Tuple3dState(2, 0, 0));
        leaf3DState2.setEndPoint2(new Tuple3dState(0, 4, 0));
        leaf3DState2.setInitialEndPoint1(new Tuple3dState(0.2, 0, 0));
        leaf3DState2.setInitialEndPoint2(new Tuple3dState(0, 0.4, 0));
        TreeLeaf3DState leaf3DState3 = new TreeLeaf3DState();
        leaf3DState3.setEndPoint1(new Tuple3dState(3, 0, 0));
        leaf3DState3.setEndPoint2(new Tuple3dState(0, 4, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
        TreeLeafState leafState3 = new TreeLeafState();
View Full Code Here


    /**
     * Test with 3 leaves, one of which has 0 for area
     */
    public void testGetRandomLeafToIncrease4() {
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        leaf3DState1.setEndPoint1(new Tuple3dState(0, 0, 0));
        leaf3DState1.setEndPoint2(new Tuple3dState(0, 0, 0));
        // this is to ensure the leaf is not considered to have reached its maximum size
        leaf3DState1.setInitialEndPoint1(new Tuple3dState(0.2, 0, 0));
        leaf3DState1.setInitialEndPoint2(new Tuple3dState(0, 0.2, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        leaf3DState2.setEndPoint1(new Tuple3dState(2, 0, 0));
        leaf3DState2.setEndPoint2(new Tuple3dState(0, 4, 0));
        TreeLeaf3DState leaf3DState3 = new TreeLeaf3DState();
        leaf3DState3.setEndPoint1(new Tuple3dState(3, 0, 0));
        leaf3DState3.setEndPoint2(new Tuple3dState(0, 4, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
        TreeLeafState leafState3 = new TreeLeafState();
View Full Code Here

    /**
     * Test with 2 leaves, one of which has 0 for area
     */
    public void testGetRandomLeafToIncrease5() {
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        leaf3DState1.setEndPoint1(new Tuple3dState(0, 0, 0));
        leaf3DState1.setEndPoint2(new Tuple3dState(0, 0, 0));
        // this is to ensure the leaf is not considered to have reached its maximum size
        leaf3DState1.setInitialEndPoint1(new Tuple3dState(0.2, 0, 0));
        leaf3DState1.setInitialEndPoint2(new Tuple3dState(0, 0.2, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        leaf3DState2.setEndPoint1(new Tuple3dState(2, 0, 0));
        leaf3DState2.setEndPoint2(new Tuple3dState(0, 4, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

        TreeLeafStateFactory factory = new TreeLeafStateFactory();
        Point3d leafAttachPoint = new Point3d(Math.random(), Math.random(), Math.random());
        BigDecimal energy = new BigDecimal(30);
        TreeLeafState treeLeafState = factory.createNewTreeLeafState(leafAttachPoint, energy);
        assertNotNull(treeLeafState);
        TreeLeaf3DState leaf3dState = treeLeafState.getLeaf3DState();
        assertNotNull(leaf3dState);
        // check it is an newly created leaf 3D
        assertEquals(leaf3dState.getInitialEndPoint1(), leaf3dState.getEndPoint1());
        assertEquals(leaf3dState.getInitialEndPoint2(), leaf3dState.getEndPoint2());
        assertTrue(PercentHelper.getDecimalValue(90).compareTo(treeLeafState.getEfficiency()) <= 0);
        assertTrue(PercentHelper.getDecimalValue(100).compareTo(treeLeafState.getEfficiency()) >= 0);
        assertEquals(0, treeLeafState.getAge());
        assertEquals(energy, treeLeafState.getEnergy());
        assertEquals(new BigDecimal(0), treeLeafState.getFreeEnergy());
View Full Code Here

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

    public void testComputeAttachPointForNewleafState1() {
        // create object states
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        leaf3DState1.setLeafAttachPoint(new Tuple3dState(2, 0, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        leaf3DState2.setLeafAttachPoint(new Tuple3dState(3, 0, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

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

    public void testComputeAttachPointForNewleafState2() {
        // create object states
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        leaf3DState1.setLeafAttachPoint(new Tuple3dState(1, 0, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        leaf3DState2.setLeafAttachPoint(new Tuple3dState(5, 0, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>(2);
View Full Code Here

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

    public static TreeLeafState createRandomTreeLeafState() {
        PercentState efficiency = UtilDataCreatorForTests.createPercentState();
        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(createRandomId(), age, energy, freeEnergy, efficiency, leafd3DState);
    }
View Full Code Here

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

        this.id = new Long(0);
        this.efficiency = new PercentState();
        this.energy = new BigDecimal(0);
        this.freeEnergy = new BigDecimal(0);
        this.age = 0;
        this.leaf3DState = new TreeLeaf3DState();
    }
View Full Code Here

        this.id = copy.id;
        this.efficiency = new PercentState(copy.efficiency);
        this.energy = copy.energy;
        this.freeEnergy = copy.freeEnergy;
        this.age = copy.age;
        this.leaf3DState = new TreeLeaf3DState(copy.leaf3DState);
    }
View Full Code Here

TOP

Related Classes of barsuift.simLife.j3d.tree.TreeLeaf3DState

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.