Beispiel #1
0
        public static new List<FigSynthProblem> SubtractShape(Figure outerShape, List<Connection> conns, List<Point> points)
        {
            // Possible quadrilaterals.
            List<Quadrilateral> quads = null;

            if (outerShape is ConcavePolygon) quads = Quadrilateral.GetQuadrilateralsFromPoints(outerShape as ConcavePolygon, points);
            else quads = Quadrilateral.GetQuadrilateralsFromPoints(points);

            List<FigSynthProblem> composed = new List<FigSynthProblem>();
            foreach (Quadrilateral quad in quads)
            {
                // Require a trapezoid that doesn't match the outer shape.
                if (quad.VerifyTrapezoid() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    Trapezoid trap = new Trapezoid(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, trap);
                    try
                    {
                        subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, trap.points, trap));
                        composed.Add(subSynth);
                    }
                    catch (Exception) { }
                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Beispiel #2
0
        public override bool Equals(Object obj)
        {
            Trapezoid thatTrap = obj as Trapezoid;

            if (thatTrap == null)
            {
                return(false);
            }

            if (thatTrap is IsoscelesTrapezoid)
            {
                return(false);
            }

            return(StructurallyEquals(obj));
        }
Beispiel #3
0
        public override bool StructurallyEquals(Object obj)
        {
            Trapezoid thatTrap = obj as Trapezoid;

            if (thatTrap == null)
            {
                return(false);
            }

            if (thatTrap is IsoscelesTrapezoid)
            {
                return(false);
            }

            //return base.StructurallyEquals(obj);
            return(base.HasSamePoints(obj as Quadrilateral));
        }
Beispiel #4
0
        //
        // Can this Quadrilateral be strengthened to any of the specific quadrilaterals (parallelogram, kite, square, etc)?
        //
        public static List <Strengthened> CanBeStrengthened(Quadrilateral thatQuad)
        {
            List <Strengthened> strengthened = new List <Strengthened>();

            if (thatQuad.VerifyParallelogram())
            {
                strengthened.Add(new Strengthened(thatQuad, new Parallelogram(thatQuad)));
            }

            if (thatQuad.VerifyRectangle())
            {
                strengthened.Add(new Strengthened(thatQuad, new Rectangle(thatQuad)));
            }

            if (thatQuad.VerifySquare())
            {
                strengthened.Add(new Strengthened(thatQuad, new Square(thatQuad)));
            }

            if (thatQuad.VerifyRhombus())
            {
                strengthened.Add(new Strengthened(thatQuad, new Rhombus(thatQuad)));
            }

            if (thatQuad.VerifyKite())
            {
                strengthened.Add(new Strengthened(thatQuad, new Kite(thatQuad)));
            }

            if (thatQuad.VerifyTrapezoid())
            {
                Trapezoid newTrap = new Trapezoid(thatQuad);
                strengthened.Add(new Strengthened(thatQuad, newTrap));

                if (thatQuad.VerifyIsoscelesTrapezoid())
                {
                    strengthened.Add(new Strengthened(newTrap, new IsoscelesTrapezoid(thatQuad)));
                }
            }

            return(strengthened);
        }
        private static List<EdgeAggregator> InstantiateToTheorem(Trapezoid trapezoid, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // If median has not been checked, check now
            if (!trapezoid.IsMedianChecked()) trapezoid.FindMedian();
            // Generate only if the median is valid (exists in the original figure)
            if (!trapezoid.IsMedianValid()) return newGrounded;

            GeometricParallel newParallel1 = new GeometricParallel(trapezoid.median, trapezoid.oppBaseSegment);
            GeometricParallel newParallel2 = new GeometricParallel(trapezoid.median, trapezoid.baseSegment);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, newParallel1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, newParallel2, annotation));

            return newGrounded;
        }
        private static List<EdgeAggregator> InstantiateToTheorem(Trapezoid trapezoid, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // If median has not been checked, check now
            if (!trapezoid.IsMedianChecked()) trapezoid.FindMedian();
            // Generate only if the median is valid (exists in the original figure)
            if (!trapezoid.IsMedianValid()) return newGrounded;

            Addition sum = new Addition(trapezoid.baseSegment, trapezoid.oppBaseSegment);
            Multiplication product = new Multiplication(new NumericValue(2), trapezoid.median);

            GeometricSegmentEquation gseq = new GeometricSegmentEquation(product, sum);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, gseq, annotation));

            return newGrounded;
        }
        private static List<EdgeAggregator> InstantiateFromIsoscelesTrapezoid(Trapezoid trapezoid, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Create the congruent, oppsing side segments
            GeometricCongruentSegments gcs = new GeometricCongruentSegments(trapezoid.leftLeg, trapezoid.rightLeg);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, gcs, annotation));

            return newGrounded;
        }
        private static List<EdgeAggregator> InstantiateToIsoscelesTrapezoid(Trapezoid trapezoid, CongruentSegments css, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Does this paralle set apply to this triangle?
            if (!trapezoid.CreatesCongruentLegs(css)) return newGrounded;

            //
            // Create the new IsoscelesTrapezoid object
            //
            Strengthened newIsoscelesTrapezoid = new Strengthened(trapezoid, new IsoscelesTrapezoid(trapezoid));

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);
            antecedent.Add(css);

            newGrounded.Add(new EdgeAggregator(antecedent, newIsoscelesTrapezoid, annotation));

            return newGrounded;
        }
Beispiel #9
0
        //
        // Can this Quadrilateral be strengthened to any of the specific quadrilaterals (parallelogram, kite, square, etc)?
        //
        public static List<Strengthened> CanBeStrengthened(Quadrilateral thatQuad)
        {
            List<Strengthened> strengthened = new List<Strengthened>();

            if (thatQuad.VerifyParallelogram())
            {
                strengthened.Add(new Strengthened(thatQuad, new Parallelogram(thatQuad)));
            }

            if (thatQuad.VerifyRectangle())
            {
                strengthened.Add(new Strengthened(thatQuad, new Rectangle(thatQuad)));
            }

            if (thatQuad.VerifySquare())
            {
                strengthened.Add(new Strengthened(thatQuad, new Square(thatQuad)));
            }

            if (thatQuad.VerifyRhombus())
            {
                strengthened.Add(new Strengthened(thatQuad, new Rhombus(thatQuad)));
            }

            if (thatQuad.VerifyKite())
            {
                strengthened.Add(new Strengthened(thatQuad, new Kite(thatQuad)));
            }

            if (thatQuad.VerifyTrapezoid())
            {
                Trapezoid newTrap = new Trapezoid(thatQuad);
                strengthened.Add(new Strengthened(thatQuad, newTrap));

                if (thatQuad.VerifyIsoscelesTrapezoid())
                {
                    strengthened.Add(new Strengthened(newTrap, new IsoscelesTrapezoid(thatQuad)));
                }
            }

            return strengthened;
        }
        private static List<EdgeAggregator> InstantiateFromTrapezoid(Trapezoid trapezoid, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            //
            // Determine the parallel opposing sides and output that.
            //
            GeometricParallel newParallel = new GeometricParallel(trapezoid.baseSegment, trapezoid.oppBaseSegment);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, newParallel, annotation));

            return newGrounded;
        }