Package barsuift.simLife.j3d.tree

Examples of barsuift.simLife.j3d.tree.TreeLeaf3DState


    /**
     * 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

        BigDecimal energy = new BigDecimal(30);
        long creationMillis = 200;
        TreeLeafState treeLeafState = factory.createNewTreeLeafState(new Transform3D(), energy, creationMillis);
        assertNotNull(treeLeafState);
        assertEquals(creationMillis, treeLeafState.getCreationMillis());
        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(energy, treeLeafState.getEnergy());
        assertEquals(new BigDecimal(0), treeLeafState.getFreeEnergy());
    }
View Full Code Here

    }


    public void testComputeAttachPointForNewleafState1() {
        // create object states
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState1, new Vector3d(2, 0, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState2, new Vector3d(3, 0, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
View Full Code Here

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

    public void testComputeAttachPointForNewleafState2() {
        // create object states
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState1, new Vector3d(1, 0, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState2, new Vector3d(5, 0, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
View Full Code Here

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

    public void testComputeAttachPointForNewLeaf3() {
        // create object states
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState1, new Vector3d(2, 0, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState2, new Vector3d(3, 0, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
View Full Code Here

    /**
     * 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 leaf3DState1 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState1, new Vector3d(2, 0, 0));
        TreeLeaf3DState leaf3DState2 = new TreeLeaf3DState();
        setLeafStateTransform(leaf3DState2, new Vector3d(3, 0, 0));
        TreeLeafState leafState1 = new TreeLeafState();
        leafState1.setLeaf3DState(leaf3DState1);
        TreeLeafState leafState2 = new TreeLeafState();
        leafState2.setLeaf3DState(leaf3DState2);
View Full Code Here

        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();
            Tuple3dState initialEndPoint1 = leaf3dState.getInitialEndPoint1();
            leaf3dState.setEndPoint1(new Tuple3dState(initialEndPoint1.getX() * 10, initialEndPoint1.getY() * 10,
                    initialEndPoint1.getZ() * 10));
            Tuple3dState initialEndPoint2 = leaf3dState.getInitialEndPoint2();
            leaf3dState.setEndPoint2(new Tuple3dState(initialEndPoint2.getX() * 10, initialEndPoint2.getY() * 10,
                    initialEndPoint2.getZ() * 10));
        }
        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertFalse(part.canIncreaseOneLeafSize());

View Full Code Here

        TreeLeafState firstLeafState = branchPartState.getLeaveStates().get(0);
        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();
            Tuple3dState initialEndPoint1 = leaf3dState.getInitialEndPoint1();
            leaf3dState.setEndPoint1(new Tuple3dState(initialEndPoint1.getX() * 10, initialEndPoint1.getY() * 10,
                    initialEndPoint1.getZ() * 10));
            Tuple3dState initialEndPoint2 = leaf3dState.getInitialEndPoint2();
            leaf3dState.setEndPoint2(new Tuple3dState(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 Tuple3dState());
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), branchPartState);
View Full Code Here

                .getState().getEndPoint1().toPointValue());
        assertEquals(new BigDecimal(110), part.getEnergy());
    }

    public void testGetRandomLeafToIncrease1() {
        TreeLeaf3DState leaf3DState1 = new TreeLeaf3DState();
        leaf3DState1.setEndPoint1(new Tuple3dState(2, 0, 0));
        leaf3DState1.setEndPoint2(new Tuple3dState(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

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.