Пример #1
0
        public override List <Segment> Segmentize()
        {
            if (approxSegments.Any())
            {
                return(approxSegments);
            }

            // How much we will change the angle measure as we create segments.
            double angleIncrement = Angle.toRadians(this.minorMeasure / Figure.NUM_SEGS_TO_APPROX_ARC);

            // Find the first point so we sweep in a counter-clockwise manner.
            double angle1 = Point.GetRadianStandardAngleWithCenter(theCircle.center, endpoint1);
            double angle2 = Point.GetRadianStandardAngleWithCenter(theCircle.center, endpoint2);

            Point  firstPoint  = null;
            Point  secondPoint = null;
            double angle       = -1;

            GetStartEndPoints(angle1, angle2, out firstPoint, out secondPoint, out angle);

            for (int i = 1; i <= Figure.NUM_SEGS_TO_APPROX_ARC; i++)
            {
                // Save this as an approximating point.
                approxPoints.Add(firstPoint);

                // Get the next point.
                angle      += angleIncrement;
                secondPoint = Point.GetPointFromAngle(theCircle.center, theCircle.radius, angle);

                // Make the segment.
                approxSegments.Add(new Segment(firstPoint, secondPoint));

                // Rotate points.
                firstPoint = secondPoint;
            }

            // Save this as an approximating point.
            approxPoints.Add(secondPoint);

            return(approxSegments);
        }
Пример #2
0
        public override List <Segment> Segmentize()
        {
            if (approxSegments.Any())
            {
                return(approxSegments);
            }

            // How much we will change the angle measure as we create segments.
            double angleIncrement = Math.PI / Figure.NUM_SEGS_TO_APPROX_ARC;

            Point  firstPoint  = null;
            Point  secondPoint = null;
            double angle       = -1;

            GetStartEndPoints(out firstPoint, out secondPoint, out angle);

            for (int i = 1; i <= Figure.NUM_SEGS_TO_APPROX_ARC; i++)
            {
                // Save this as an approximating point.
                approxPoints.Add(firstPoint);

                // Get the next point.
                angle      += angleIncrement;
                secondPoint = Point.GetPointFromAngle(theCircle.center, theCircle.radius, angle);

                // Make the segment.
                approxSegments.Add(new Segment(firstPoint, secondPoint));

                // Rotate points.
                firstPoint = secondPoint;
            }

            // Save this as an approximating point.
            approxPoints.Add(secondPoint);

            return(approxSegments);
        }