public void PointsOnACircleTestCase1()
 {
     var center = new Point(2472, 2472);
     var calc = new CircleCalculator(center, 384);
     int angleIncrement = 30;
     for (int angle = 90; angle <= 270; angle += angleIncrement)
     {
         Point point = calc.CalculatePointOnCircle(angle);
         string result = string.Format(CultureInfo.CurrentCulture, "Drawing at ({0}, {1}) Angle is {2}", point.X, point.Y, angle);
         Debug.WriteLine(result);
     }
 }
示例#2
0
        private Area GetProposedAreaSemiCircle(double actualWidth, double actualHeight, Point centre, Func<Area, ProximityTestResult> overlapsWithOthers)
        {
            // A angle of 0 degrees in this context is moving directly to the right
            this.angle = this.dimensions.CalculateNextAvailableAngle();
            Area proposedArea;
            var calc = new CircleCalculator(centre, this.angle);
            double radius = 250;
            ProximityTestResult proximityResult = null;

            do
            {
                if (proximityResult != null && proximityResult.Proximity == Proximity.VeryClose)
                {
                    radius += LayoutConstants.MinimumDistanceBetweenObjects / 2;
                }
                else
                {
                    radius += LayoutConstants.MinimumDistanceBetweenObjects;
                }

                proposedArea = new Area(calc.CalculatePointOnCircle(radius), actualWidth, actualHeight);
                proposedArea = proposedArea.OffsetToMakeTopLeftCentre();
                proximityResult = overlapsWithOthers(proposedArea);
            }
            while (proximityResult.Proximity == Proximity.Overlapping || proximityResult.Proximity == Proximity.VeryClose);

            return proposedArea;
        }