예제 #1
0
        //
        // Atomize the circle by creating:
        //    (1) all radii connecting to other known polygon / circle intersection points.
        //    (2) all chords connecting the radii
        //
        //    All constructed segments may intersect at imaginary points; these need to be calculated
        //
        public static List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion> Atomize(GeometryTutorLib.ConcreteAST.Circle circle)
        {
            List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion> atoms = new List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion>();
            List<GeometryTutorLib.ConcreteAST.Point> interPts = circle.GetIntersectingPoints();

            //
            // Construct the radii
            //
            List<GeometryTutorLib.ConcreteAST.Segment> radii = new List<GeometryTutorLib.ConcreteAST.Segment>();
            foreach (GeometryTutorLib.ConcreteAST.Point interPt in interPts)
            {
                radii.Add(new GeometryTutorLib.ConcreteAST.Segment(circle.center, interPt));
            }

            //
            // Construct the chords
            //
            List<GeometryTutorLib.ConcreteAST.Segment> chords = new List<GeometryTutorLib.ConcreteAST.Segment>();
            for (int p1 = 0; p1 < interPts.Count - 1; p1++)
            {
                for (int p2 = p1 + 1; p2 < interPts.Count; p2++)
                {
                    chords.Add(new GeometryTutorLib.ConcreteAST.Segment(interPts[p1], interPts[p2]));
                }
            }

            //
            // Do any of the chords intersect the radii?
            //

            //
            // Do the chords intersect each other?
            //
            return new List<GeometryTutorLib.Area_Based_Analyses.Atomizer.AtomicRegion>();
        }
        //
        // If no radii are drawn, construct them as well as the chords connecting them.
        //
        private void AddImpliedSegments(GeometryTutorLib.ConcreteAST.Circle circle)
        {
            List<GeometryTutorLib.ConcreteAST.Segment> constructedChords = new List<GeometryTutorLib.ConcreteAST.Segment>();
            List<GeometryTutorLib.ConcreteAST.Segment> constructedRadii = new List<GeometryTutorLib.ConcreteAST.Segment>();
            List<Point> imagPoints = new List<Point>();

            List<GeometryTutorLib.ConcreteAST.Point> interPts = circle.GetIntersectingPoints();

            // If there are no points of interest, the circle is the atomic region.
            if (!interPts.Any()) return;

            // Construct the radii
            foreach (Point interPt in interPts)
            {
                GeometryTutorLib.Utilities.AddStructurallyUnique<GeometryTutorLib.ConcreteAST.Segment>(implied.segments,
                                                                                                       new GeometryTutorLib.ConcreteAST.Segment(circle.center, interPt));
            }

            // Construct the chords
            for (int p1 = 0; p1 < interPts.Count - 1; p1++)
            {
                for (int p2 = p1 + 1; p2 < interPts.Count; p2++)
                {
                    GeometryTutorLib.Utilities.AddStructurallyUnique<GeometryTutorLib.ConcreteAST.Segment>(implied.segments,
                                                                                                           new GeometryTutorLib.ConcreteAST.Segment(interPts[p1], interPts[p2]));
                }
            }
        }