Exemplo n.º 1
0
        /**
         * Update renderQuee with a EP-tree representing the next generation of the last tree created
         */
        internal override void Grow()
        {
            if (treeAdded)
            {
                if (growthCount >= growLimit)
                {
                    growthCount = 0;
                    int maxGenerations = presentTreeTool.maxGeneration;
                    int nLeaves = presentTreeTool.nLeaves;

                    if (currentTree.generation > maxGenerations) return;

                    Tree lastTree = currentTree;
                    Point[] newLeaves = new Point[nLeaves];

                    // Grow all branches
                    for (int i = 0; i < nLeaves; i++)
                    {
                        Point newLeaf = GetLeaf(lastTree.leaves[i], lastTree.root, presentTreeTool.branchLength);
                        newLeaves[i] = newLeaf;
                    }

                    Tree grownTree = CreateTree(lastTree.color, lastTree.root, newLeaves, lastTree.leaves);
                    grownTree.generation = currentTree.generation + 1;
                    currentTree = grownTree;
                    renderQueue.Enqueue(currentTree);
                }
                else
                {
                    growthCount += growthSpeed;
                }
            }
        }
Exemplo n.º 2
0
 internal override void Add(Point root, bool alwaysAdd)
 {
     if (alwaysAdd || !PointInsideTree(root))
     {
         Tree tree = CreateDefaultTree(root);
         currentTree = tree;
         renderQueue.Enqueue(tree);
         treeAdded = true;
     }
 }