using System;
using System.Collections.Generic;
using Assets.Common;

namespace Assets.PointDistribution
{
    public class RegularDistribution : IPointDistribution
    {
        public readonly float Radius;

        public RegularDistribution(float radius)
        {
            Radius = radius;
        }

        public IEnumerable<Point> Generate(double width, double height)
        {
            int xMax = (int)Math.Ceiling(width / Radius);
            int yMax = (int)Math.Ceiling(height / Radius);
            
            for (int x = 0; x < xMax + 1; x++)
                for (int y = 0; y < yMax + 1; y++)
                    yield return new Point(x * width / xMax, y * height / yMax);
        }
    }
}