Ejemplo n.º 1
0
        //
        // Outer minus circle; the circle will only be situation if it touches all sides of the outer figure.
        //
        public static List<FigSynthProblem> SubtractShape(Figure outerShape, List<Connection> conns, List<Point> points)
        {
            List<FigSynthProblem> composed = new List<FigSynthProblem>();
            List<Midpoint> midpoints = outerShape.GetMidpointClauses();

            if (midpoints.Count < 3) return composed;

            //
            // Construct the circle based on the first 3 points.
            //
            Circle circ = Circle.ConstructCircle(midpoints[0].point, midpoints[1].point, midpoints[2].point);

            //
            // Verify that the remaining points lie on the circle.
            //
            for (int p = 4; p < midpoints.Count; p++)
            {
                if (!circ.PointLiesOn(midpoints[p].point)) return composed;
            }

            SubtractionSynth subSynth = new SubtractionSynth(outerShape, circ);

            composed.Add(subSynth);

            return composed;
        }
Ejemplo n.º 2
0
        //
        // Outer minus circle; the circle will only be situation if it touches all sides of the outer figure.
        //
        public static List <FigSynthProblem> SubtractShape(Figure outerShape, List <Connection> conns, List <Point> points)
        {
            List <FigSynthProblem> composed  = new List <FigSynthProblem>();
            List <Midpoint>        midpoints = outerShape.GetMidpointClauses();

            if (midpoints.Count < 3)
            {
                return(composed);
            }

            //
            // Construct the circle based on the first 3 points.
            //
            Circle circ = Circle.ConstructCircle(midpoints[0].point, midpoints[1].point, midpoints[2].point);

            //
            // Verify that the remaining points lie on the circle.
            //
            for (int p = 4; p < midpoints.Count; p++)
            {
                if (!circ.PointLiesOn(midpoints[p].point))
                {
                    return(composed);
                }
            }

            SubtractionSynth subSynth = new SubtractionSynth(outerShape, circ);

            composed.Add(subSynth);

            return(composed);
        }