Beispiel #1
0
        private Rectangle TryMoveToCenter(Rectangle rectangle, PolarFunction function)
        {
            var correctRectangle = rectangle;
            var line             = new PolarDecreasingLine(function.Center, function.Length, function.Angle);

            while (true)
            {
                var point                 = line.GetNextPoint();
                var rextRectangle         = CreateRectangle(point, rectangle.Size);
                var intersectingRectangle = GetIntersection(rextRectangle);
                if (intersectingRectangle == default(Rectangle) && Math.Abs(line.Length) > 1e-10)
                {
                    correctRectangle = rextRectangle;
                }
                else
                {
                    return(correctRectangle);
                }
            }
        }
Beispiel #2
0
 public CircularCloudBuilder(PolarFunction function)
 {
     _function = function;
     _cloud    = new List <Rectangle>();
 }