Beispiel #1
0
        public static Figure ConstructDefaultShape(ShapeType type)
        {
            switch (type)
            {
            case ShapeType.TRIANGLE:               return(Triangle.ConstructDefaultTriangle());

            case ShapeType.ISOSCELES_TRIANGLE:     return(IsoscelesTriangle.ConstructDefaultIsoscelesTriangle());

            case ShapeType.RIGHT_TRIANGLE:         return(RightTriangle.ConstructDefaultRightTriangle());

            case ShapeType.EQUILATERAL_TRIANGLE:   return(EquilateralTriangle.ConstructDefaultEquilateralTriangle());

            case ShapeType.KITE:                   return(Kite.ConstructDefaultKite());

            case ShapeType.QUADRILATERAL:          return(Quadrilateral.ConstructDefaultQuadrilateral());

            case ShapeType.TRAPEZOID:              return(Trapezoid.ConstructDefaultTrapezoid());

            case ShapeType.ISO_TRAPEZOID:          return(IsoscelesTrapezoid.ConstructDefaultIsoscelesTrapezoid());

            case ShapeType.PARALLELOGRAM:          return(Parallelogram.ConstructDefaultParallelogram());

            case ShapeType.RECTANGLE:              return(Rectangle.ConstructDefaultRectangle());

            case ShapeType.RHOMBUS:                return(Rhombus.ConstructDefaultRhombus());

            case ShapeType.SQUARE:                 return(Square.ConstructDefaultSquare());

            case ShapeType.CIRCLE:                 return(Circle.ConstructDefaultCircle());

            case ShapeType.SECTOR:                 return(Sector.ConstructDefaultSector());
            }

            return(null);
        }
Beispiel #2
0
        public override bool Equals(Object obj)
        {
            Parallelogram thatPara = obj as Parallelogram;

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

            if (thatPara is Rhombus)
            {
                return(false);
            }

            return(StructurallyEquals(obj));
        }
        private static List<EdgeAggregator> InstantiateTheorem(Parallelogram parallelogram, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Determine the CongruentSegments opposing sides and output that.
            GeometricCongruentSegments gcs1 = new GeometricCongruentSegments(parallelogram.top, parallelogram.bottom);
            GeometricCongruentSegments gcs2 = new GeometricCongruentSegments(parallelogram.left, parallelogram.right);

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

            newGrounded.Add(new EdgeAggregator(antecedent, gcs1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, gcs2, annotation));

            return newGrounded;
        }
Beispiel #4
0
        public override bool StructurallyEquals(Object obj)
        {
            Parallelogram thatPara = obj as Parallelogram;

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

            if (thatPara is Rhombus || thatPara is Rectangle)
            {
                return(false);
            }

            //return base.StructurallyEquals(obj);
            return(base.HasSamePoints(thatPara as Quadrilateral));
        }
Beispiel #5
0
        public new static 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)
            {
                // Select only parallelograms that don't match the outer shape.
                if (quad.VerifyParallelogram() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    Parallelogram para = new Parallelogram(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, para);

                    try
                    {
                        subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, para.points, para));
                        composed.Add(subSynth);
                    }
                    catch (Exception) { }
                }
            }

            return(FigSynthProblem.RemoveSymmetric(composed));
        }
        private static List<EdgeAggregator> InstantiateToRectangle(Parallelogram parallelogram, RightAngle ra, GroundedClause originalPara, GroundedClause originalRightAngle)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Does this right angle apply to this quadrilateral?
            if (!parallelogram.HasAngle(ra)) return newGrounded;

            //
            // Create the new Rectangle object
            //
            Strengthened newRectangle = new Strengthened(parallelogram, new Rectangle(parallelogram));

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

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

            return newGrounded;
        }
Beispiel #7
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)
            {
                // Select only parallelograms that don't match the outer shape.
                if (quad.VerifyParallelogram() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    Parallelogram para = new Parallelogram(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, para);

                    try
                    {
                        subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, para.points, para));
                        composed.Add(subSynth);
                    }
                    catch (Exception) { }

                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
        private static List<EdgeAggregator> InstantiateFromParallelogram(Parallelogram Parallelogram, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            //
            // Determine the parallel opposing sides and output that.
            //
            Parallel newParallel1 = new Parallel(Parallelogram.top, Parallelogram.bottom);
            Parallel newParallel2 = new Parallel(Parallelogram.left, Parallelogram.right);

            // 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;
        }