public void Develop(Internode internode, SimulationStateSnapshot snapshot)
        {
            var description = plantDescriptorService.Describe(internode, true);

            if (ShouldGrow(internode, description))
            {
                GrowInternode(internode, snapshot);
            }

            if (ShouldAddNewNode(internode, snapshot, description.Height))
            {
                internode.UpperNode = CreateNewUpperNode(internode, description);
            }
        }
예제 #2
0
        public void Develop(Root plantPart, SimulationStateSnapshot snapshot)
        {
            var descriptor = plantDescriptorService.Describe(plantPart, false);

            if (ShouldGrow(plantPart, descriptor, snapshot))
            {
                CellIterator.IterateCells(plantPart.Cells, cell => cellGrower.GrowRootCell(cell, plantPart, snapshot));
            }

            if (ShouldAddLateralRoot(plantPart, descriptor, snapshot))
            {
                var newRoot = CreateNewRoot(descriptor, plantPart);

                plantPart.ConnectRoot(newRoot);
            }
        }
예제 #3
0
        private PlantNodeModelState CreateStateFromPlantPart(IPlantPart part)
        {
            var asTop      = part.PartType == PlantPartType.Root;
            var descriptor = descriptorService.Describe(part, asTop);

            var top3 = descriptor.Top;
            var bot3 = descriptor.Bottom;

            var top = new Vector2(top3.X, top3.Y);
            var bot = new Vector2(bot3.X, bot3.Y);

            return(new PlantNodeModelState
            {
                Thickness = ComputeThickness(descriptor),
                Description = $"{part.PartType} ({part.BranchCount})",
                Connections = new PlantNodeModelState[0],
                Coordinates = new[] { bot, top }
            });
        }