social_learning.World.spiralLayout C# (CSharp) Method

spiralLayout() private method

private spiralLayout ( ) : void
return void
        private void spiralLayout()
        {
            int speciesIdx = 0;
            foreach (var species in PlantTypes)
            {
                double theta = _random.NextDouble() * 2 * Math.PI;
                double dtheta = (_random.NextDouble()) / 15 + .1;
                dtheta *= _random.Next(2) == 1 ? -1 : 1;
                int x;
                int y;
                double r = 6;

                for (int i = 0; i < species.Count; i++)
                {
                    r += (Height - 6) / (double)(2 * species.Count);
                    theta += dtheta;
                    x = (int)(Width / 2 + r * Math.Cos(theta));
                    y = (int)(Width / 2 + r * Math.Sin(theta));
                    var plant = Plants[speciesIdx * species.Count + i];
                    plant.Reset();
                    plant.X = x;
                    plant.Y = y;
                }
                speciesIdx++;
            }
        }