//     A _________________ B
        //      /                /
        //     /                /
        //    /                /
        // D /________________/ C
        //
        // Parallelogram(A, B, C, D) -> SegmentBisector(Segment(A, C), Segment(B, D)), SegmentBisector(Segment(B, D), Segment(A, C)),
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.DIAGONALS_PARALLELOGRAM_BISECT_EACH_OTHER;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Parallelogram)
            {
                Parallelogram newPara = clause as Parallelogram;

                newGrounded.AddRange(InstantiateTheorem(newPara, newPara));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Parallelogram))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateTheorem(streng.strengthened as Parallelogram, streng));
            }

            return(newGrounded);
        }
        //     A _________________ B
        //      /                /
        //     /     \/         /
        //    /      /\        /
        // D /________________/ C
        //
        // Parallelogram(A, B, C, D) -> SegmentBisector(Segment(A, C), Segment(B, D)), SegmentBisector(Segment(B, D), Segment(A, C)),
        //
        private static List <EdgeAggregator> InstantiateTheorem(Parallelogram parallelogram, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Generate only if the diagonals are a part of the original figure.
            if (parallelogram.diagonalIntersection == null)
            {
                return(newGrounded);
            }

            // Determine the CongruentSegments opposing sides and output that.
            Intersection diagInter = parallelogram.diagonalIntersection;
            Strengthened sb1       = new Strengthened(diagInter, new SegmentBisector(diagInter, diagInter.lhs));
            Strengthened sb2       = new Strengthened(diagInter, new SegmentBisector(diagInter, diagInter.rhs));

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

            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, sb1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, sb2, annotation));

            return(newGrounded);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            // NOTE: All coordinates are assumed to form the proper shapes
            // A quadrilateral is a four-sided polygon
            Quadrilateral quadrilateral =
                new Quadrilateral(1.1, 1.2, 6.6, 2.8, 6.2, 9.9, 2.2, 7.4);

            // A trapezoid is a quadrilateral having exactly two parallel sides
            Trapezoid trapezoid =
                new Trapezoid(0.0, 0.0, 10.0, 0.0, 8.0, 5.0, 3.3, 5.0);

            // A parallelogram is a quadrilateral with opposite sides parallel
            Parallelogram parallelogram =
                new Parallelogram(5.0, 5.0, 11.0, 5.0, 12.0, 20.0, 6.0, 20.0);

            // A rectangle is an equiangular parallelogram
            Rectangle rectangle =
                new Rectangle(17.0, 14.0, 30.0, 14.0, 30.0, 28.0, 17.0, 28.0);

            // A square is an equiangular and equilateral parallelogram
            Square square =
                new Square(4.0, 0.0, 8.0, 0.0, 8.0, 4.0, 4.0, 4.0);

            Console.WriteLine("{0} {1} {2} {3} {4}",
                              quadrilateral, trapezoid, parallelogram, rectangle, square);

            Console.Read();
        }
Esempio n. 4
0
        public void AreaPerimetrParalllelogram()
        {
            Parallelogram parallelogram = new Parallelogram(8, 10);

            Assert.AreEqual(79.148659729870545, parallelogram.Area());
            Assert.AreEqual(36, parallelogram.Perimetr());
        }
Esempio n. 5
0
        private Vector3[] Get(Parallelogram p)
        {
            return(new[]
            {
                p.p0.Convert(),
                new Vector3(1, 0, 0),
                p.p1.Convert(),
                new Vector3(1, 0, 0),

                p.p1.Convert(),
                new Vector3(1, 0, 0),
                p.p2.Convert(),
                new Vector3(1, 0, 0),

                p.p2.Convert(),
                new Vector3(1, 0, 0),
                p.p3.Convert(),
                new Vector3(1, 0, 0),

                p.p3.Convert(),
                new Vector3(1, 0, 0),
                p.p0.Convert(),
                new Vector3(1, 0, 0),
            });
        }
        //     A _________________ B
        //      /                /
        //     /                /
        //    /                /
        // D /________________/ C
        //
        // Parallelogram(A, B, C, D) -> Congruent(Angle(DAB), Angle(BCD)), Congruent(Angle(ADC), Angle(ABC))
        //
        public static List <EdgeAggregator> Instantiate(GroundedClause clause)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.OPPOSITE_ANGLES_PARALLELOGRAM_ARE_CONGRUENT;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            if (clause is Parallelogram)
            {
                Parallelogram para = clause as Parallelogram;

                newGrounded.AddRange(InstantiateTheorem(para, para));
            }
            else if (clause is Strengthened)
            {
                Strengthened streng = clause as Strengthened;

                if (!(streng.strengthened is Parallelogram))
                {
                    return(newGrounded);
                }

                newGrounded.AddRange(InstantiateTheorem(streng.strengthened as Parallelogram, streng));
            }

            return(newGrounded);
        }
Esempio n. 7
0
        public void Execute()
        {
            var mover        = game.Player.Mover;
            var cameraPos    = mover.Position.Add(new PointF(0, game.Player.Height, 0));
            var line         = new Line(cameraPos, mover.Front);
            var piece        = new Piece(game.World, cameraPos.AsPointL(), 4, game.Animals);
            var closestBlock = piece.Helper()
                               .Where(pair => pair.block != null && pair.block != Block.Either)
                               .Where(pair => Block.GetGeometry(pair.block.BlockType, pair.position).IsIntersect(line))
                               .OrderBy(pair =>
                                        cameraPos.GetSquaredDistance(pair.position.AsPointF().Add(new Vector3(0.5f))))
                               .FirstOrDefault();

            if (closestBlock == default((PointL, Block)))
            {
                return;
            }

            var geometry = Block.GetGeometry(closestBlock.block.BlockType, closestBlock.position);
            var planes   = geometry.GetPlanes().ToArray();

            var intersectPoints = geometry.GetIntersectPoints(line).OrderBy(cameraPos.GetSquaredDistance).ToList();

            if (!intersectPoints.Any())
            {
                return;
            }
            var closestPoint = intersectPoints.First();

            var closestPlane = planes.First(p => p.ContainsPoint(closestPoint));
            var index        = Array.IndexOf(planes, closestPlane);

            figure = geometry.Squads[index];
        }
Esempio n. 8
0
        public static Parallelogram SetParallelogram(out string name, out string type, out double a, out double b,
                                                     out double h, out double area, out double perim, out int tops, out int edges)
        {
            Console.Write("Set Name of Parallelogram: ");
            name = Console.ReadLine();

            Console.Write("Set Type of Parallelogram: ");
            type = Console.ReadLine();

            Console.Write("Enter a side of Parallelogram:\n");
            Console.Write("a: ");
            a = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            Console.Write("Enter b side of Parallelogram:\n");
            Console.Write("b: ");
            b = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            Console.Write("Enter h:\n");
            Console.Write("h: ");
            h = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            Parallelogram parallelogram = new Parallelogram(a, b, h);

            parallelogram.Name = name;
            parallelogram.Type = type;
            area  = parallelogram.Area();
            perim = parallelogram.Perimeter();
            tops  = parallelogram.QuantityOfTops();
            edges = parallelogram.QuantityOfEdges();

            return(parallelogram);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            Triangle tr = new Triangle(new double[3] {
                -1, 1, 0
            }, new double[3] {
                0, 0, 2
            });
            Parallelogram par = new Parallelogram(new double[4] {
                -4, -1, -5, -2
            }, new double[4] {
                4, 5, 1, 2
            });
            Square sq = new Square(new double[4] {
                -1, -1, 1, 1
            }, new double[4] {
                -1, 1, 1, -1
            });

            Console.WriteLine("Area of Triange is {0}, Perimeter is {1}", tr.Area(), tr.Perimeter());

            Console.WriteLine("Area of Parallelogram is {0}, Perimeter is {1}", par.Area(), par.Perimeter());

            Console.WriteLine("Area of Square is {0}, Perimeter is {1}", sq.Area(), sq.Perimeter());

            Console.ReadKey();
        }
Esempio n. 11
0
        public void TestForArea3()
        {
            var para     = new Parallelogram(3, 8, 5);
            var result   = para.Area();
            var expected = 15;

            Assert.AreEqual(expected, result);
        }
Esempio n. 12
0
        public void TestForPerimeter3()
        {
            var para     = new Parallelogram(3, 8, 5);
            var result   = para.Perimeter();
            var expected = 22;

            Assert.AreEqual(expected, result);
        }
Esempio n. 13
0
        public static void Main(string[] args)
        {
            Parallelogram parallelogram = new Parallelogram(
                new Vertex2D(1, 2),
                new Vertex2D(4, 3),
                new Vertex2D(6, 6)
                );

            Console.WriteLine(parallelogram.D);
        }
 public void ToolMouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         parallelogram        = new Parallelogram(e.X, e.Y);
         parallelogram.width  = 0;
         parallelogram.height = 0;
         canvas.AddPuzzleObject(parallelogram);
     }
 }
Esempio n. 15
0
    public static void Main(string[] args)
    {
        Point point = new Point(5, 7);

        Console.WriteLine("点的坐标为{0}", point.ToString());
        Circle circle = new Circle(point, 2.5);

        Console.WriteLine(circle.ToString());
        Console.WriteLine("圆周长为{0},面积为{1}", circle.Perimeter(), circle.Area());
        Cylinder cylinder = new Cylinder(point, 3, 6);

        Console.WriteLine(cylinder.ToString());
        Console.WriteLine("圆柱体面积为{0},体积为{1}", cylinder.Area(), cylinder.Volume());
        Point    point1   = new Point(0, 0);
        Point    point2   = new Point(0, 2);
        Point    point3   = new Point(3, 0);
        Triangle triangle = new Triangle(point1, point2, point3);

        Console.WriteLine(triangle.ToString());
        Console.WriteLine("三角形周长为{0},面积为{1}", triangle.Perimeter(), triangle.Area());
        string s1 = triangle.IsEquicrural() ? "是" : "不是";
        string s2 = triangle.IsEquilateral() ? "是" : "不是";

        Console.WriteLine("三角形" + s1 + "等腰三角形," + s2 + "等边三角形");
        Point      point4     = new Point(3, 4);
        Trapaezoid trapaezoid = new Trapaezoid(point1, point2, point4, point3);

        Console.WriteLine(trapaezoid.ToString());
        Console.WriteLine("梯形周长为{0},面积为{1},高为{2}", trapaezoid.Perimeter(), trapaezoid.Area(), trapaezoid.H);
        Console.WriteLine(trapaezoid.WhichParallel());
        Point         point5        = new Point(3, 2);
        Parallelogram parallelogram = new Parallelogram(point1, point2, point5, point3);

        Console.WriteLine(parallelogram.ToString());
        Console.WriteLine("平行四边形周长为{0},面积为{1},两个高为{2},{3}", parallelogram.Perimeter(), parallelogram.Area(), parallelogram.H1, parallelogram.H2);
        Point   point6  = new Point(1, 0);
        Point   point7  = new Point(0, 5);
        Point   point8  = new Point(1, 10);
        Point   point9  = new Point(2, 5);
        Rhombus rhombus = new Rhombus(point6, point7, point8, point9);

        Console.WriteLine(rhombus.ToString());
        Console.WriteLine("菱形周长为{0},面积为{1},两个高为{2},{3}", rhombus.Perimeter(), rhombus.Area(), rhombus.H1, rhombus.H2);
        Rectangle rectangle = new Rectangle(point1, point2, point5, point3);

        Console.WriteLine(rectangle.ToString());
        Console.WriteLine("长方形周长为{0},面积为{1}", rectangle.Perimeter(), rectangle.Area());
        Point    point10  = new Point(2, 2);
        Point    point11  = new Point(2, 0);
        Quadrate quadrate = new Quadrate(point1, point2, point10, point11);

        Console.WriteLine(quadrate.ToString());
        Console.WriteLine("正方形周长为{0},面积为{1}", quadrate.Perimeter(), quadrate.Area());
        Console.ReadLine();
    }
Esempio n. 16
0
        public void ParallelogramMeasurement()
        {
            var parallelogram = new Parallelogram();

            parallelogram.Base   = 4;
            parallelogram.Side   = 2;
            parallelogram.Height = 3;

            Assert.AreEqual(parallelogram.Perimeter, 12.0);
            Assert.AreEqual(parallelogram.GetArea(), 12.0);
        }
Esempio n. 17
0
        public Camera(Vector3 location0, Vector3 direction, float width, int pWidth, int pHeight)
        {
            location = location0;
            float         height  = width / pWidth * pHeight;
            Vector3       center  = location + direction;
            Vector3       hOffset = Vector3.Normal(direction, new Vector3(0, 0, 1)).Unit() * width / 2;
            Vector3       vOffset = Vector3.Normal(direction, hOffset).Unit() * height / 2;
            Parallelogram border  = new Parallelogram(center - hOffset - vOffset, center - hOffset + vOffset, center + hOffset + vOffset);

            sensor = new Sensor(border, pWidth, pHeight);
        }
        private static void ShowCurvesWithColorsSet(IEnumerable <ICurve> curves,
                                                    Graph g, Form f)
        {
            AllocateDebugCurves(g);
            //   g.ShowControlPoints = true;

            var graphBox = new Rectangle();

            AddCurvesToGraph(curves, g);
            bool firstTime = true;

            foreach (ICurve c0 in curves)
            {
                if (c0 != null)
                {
                    Parallelogram b = c0.ParallelogramNodeOverICurve.Parallelogram;

                    for (int i = 0; i < 4; i++)
                    {
                        if (firstTime)
                        {
                            firstTime = false;
                            graphBox  = new Rectangle(b.Vertex((VertexId)i));
                        }
                        graphBox.Add(b.Vertex((VertexId)i));
                    }
                }
            }

            Point del = (graphBox.LeftBottom - graphBox.RightTop) / 10;

            if (del.X == 0)
            {
                del.X = 1;
            }
            if (del.Y == 0)
            {
                del.Y = 1;
            }
            graphBox.Add(graphBox.LeftBottom + del);
            graphBox.Add(graphBox.RightTop - del);
            var gg = new GeometryGraph {
                BoundingBox = graphBox
            };

            g.GeometryGraph = gg;
            try{
                DisplayGraph(g, f);
            }
            catch (Exception e) {
                Console.WriteLine(e);
            }
        }
Esempio n. 19
0
        public void IsInner_Should()
        {
            var parallelogram =
                new Parallelogram(PointF.Zero, new PointF(0, 1, 0), new PointF(1, 1, 0), new PointF(1, 0, 0));

            var random = new Random();

            for (int i = 0; i < 1e6; i++)
            {
                var point = new PointF((float)random.NextDouble(), (float)random.NextDouble(), 0);
                Assert.IsTrue(parallelogram.IsInner(point));
            }
        }
Esempio n. 20
0
    public static void Main(string[] args)
    {
        //注意所有几何体的点按照逆时针输入
        Circle circle = new Circle(0, 0, 1);

        Console.WriteLine("半径为1的圆的面积为:" + circle.Area().ToString());
        Console.WriteLine("半径为1的圆的周长为:" + circle.CircumFerence().ToString());

        Cylinder cylinder = new Cylinder();

        cylinder.R = 1;
        cylinder.h = 1;
        Console.WriteLine("半径为1,高为1的圆柱体的表面积为:" + cylinder.Area().ToString());
        Console.WriteLine("半径为1,高为1的圆柱体的体积为:" + cylinder.GetV().ToString());

        Quadrilateral quadrilateral = new Quadrilateral(1, 2, 2, 3, 3, 4, 1, 4);

        Console.WriteLine("普通四边形的周长:" + quadrilateral.Perimeter().ToString());
        Console.WriteLine("普通四边形的面积:" + quadrilateral.Area().ToString());

        Trapaezoid trapaezoid = new Trapaezoid(0, 0, 2, 0, 2, 1, 1, 1);

        Console.WriteLine("梯形的周长:" + trapaezoid.Perimeter().ToString());
        Console.WriteLine("梯形的面积:" + trapaezoid.Area().ToString());

        Parallelogram parallelogram = new Parallelogram(0, 0, 2, 0, 3, 1, 1, 1);

        Console.WriteLine("平行四边形的周长:" + parallelogram.Perimeter().ToString());
        Console.WriteLine("平行四边形的面积:" + parallelogram.Area().ToString());

        Rectangle rectangle = new Rectangle(0, 0, 2, 0, 2, 1, 0, 1);

        Console.WriteLine("长为2,宽为1的矩形面积为:" + rectangle.Area().ToString());
        Console.WriteLine("长为2,宽为1的矩形周长为:" + rectangle.Perimeter().ToString());

        Rhombus rhombus = new Rhombus(0, 0, 2, 1, 3, 3, 1, 2);

        Console.WriteLine("菱形的周长:" + rhombus.Perimeter().ToString());
        Console.WriteLine("菱形的面积:" + rhombus.Area().ToString());

        Quadrate quadrate = new Quadrate(0, 0, 1, 0, 1, 1, 0, 1);

        Console.WriteLine("正方形的周长:" + quadrate.Perimeter().ToString());
        Console.WriteLine("正方形的面积:" + quadrate.Area().ToString());

        Triangle triangle = new Triangle(new Point(0, 0), new Point(1, 0), new Point(0, 1));

        Console.WriteLine("三角形的面积为: " + triangle.Area().ToString());
        Console.WriteLine("三角形的周长为: " + triangle.Perimeter().ToString());
    }
Esempio n. 21
0
        static void Main(string[] args)
        {
            /*вычисление углов в градусах
             * вычисление длин диагоналей
             * вычисление длин сторон
             * вычисление периметра
             * вычисление площади
             */
            double a, b, c, d, d1, d2;

            Console.WriteLine("\n\nPARALLELOGRAM:");
            Parallelogram parallelogram = new Parallelogram(-3, 1, -4, 4, 0, 4, 1, 1);

            parallelogram.DisplayPoints();
            parallelogram.GetAngles(out a, out b, out c, out d);
            Console.WriteLine($"ANGLES:\nA = {a}\nB = {b}\nC = {c}\nD = {d}");
            parallelogram.GetDiagonalsLength(out d1, out d2);
            Console.WriteLine($"\nDIAGONALS:\nd1 = {d1}\nd2 = {d2}");
            parallelogram.GetSides(out a, out b, out c, out d);
            Console.WriteLine($"\nSIDES:\na = {a}\nb = {b}\nc = {c}\nd = {d}");
            Console.WriteLine($"Perimeter = {parallelogram.GetPerimeter()}");
            Console.WriteLine($"Area = {parallelogram.GetArea()}");

            Console.WriteLine("\n\nRHOMBUS:");
            Rhombus rhombus = new Rhombus(-1, -2, 0, 0, 1, -2, 0, -3);

            rhombus.DisplayPoints();
            rhombus.GetAngles(out a, out b, out c, out d);
            Console.WriteLine($"ANGLES:\nA = {a}\nB = {b}\nC = {c}\nD = {d}");
            rhombus.GetDiagonalsLength(out d1, out d2);
            Console.WriteLine($"\nDIAGONALS:\nd1 = {d1}\nd2 = {d2}");
            rhombus.GetSides(out a, out b, out c, out d);
            Console.WriteLine($"\nSIDES:\na = {a}\nb = {b}\nc = {c}\nd = {d}");
            Console.WriteLine($"Perimeter = {rhombus.GetPerimeter()}");
            Console.WriteLine($"Area = {rhombus.GetArea()}");

            Console.WriteLine("\n\nSQUARE:");
            Square sqaure = new Square(1, 1, 1, 3, 3, 3, 3, 1);

            sqaure.DisplayPoints();
            sqaure.GetAngles(out a, out b, out c, out d);
            Console.WriteLine($"ANGLES:\nA = {a}\nB = {b}\nC = {c}\nD = {d}");
            sqaure.GetDiagonalsLength(out d1, out d2);
            Console.WriteLine($"\nDIAGONALS:\nd1 = {d1}\nd2 = {d2}");
            sqaure.GetSides(out a, out b, out c, out d);
            Console.WriteLine($"\nSIDES:\na = {a}\nb = {b}\nc = {c}\nd = {d}");
            Console.WriteLine($"Perimeter = {sqaure.GetPerimeter()}");
            Console.WriteLine($"Area = {sqaure.GetArea()}");;
            Console.ReadKey();
        }
Esempio n. 22
0
        public void ParallelogramTest()
        {
            var parallelogram = new Parallelogram(4, 5);

            Assert.AreEqual(20, parallelogram.Area);
            Assert.AreEqual(4, parallelogram.Length);
            Assert.AreEqual(5, parallelogram.Height);
            Assert.AreEqual(18, parallelogram.Perimeter);


            var parallelogram2 = new Parallelogram(4, 5);

            Assert.AreEqual(parallelogram, parallelogram2);
        }
Esempio n. 23
0
    static void Main(string[] args)
    {
        Triangle triangle1 = new Triangle(1, 1, 3, 2, 2, 4);

        triangle1.Area();
        triangle1.TypeOfTriangle();
        Parallelogram par1 = new Parallelogram(-1, 1, -3, 2, -2, 4, -4, 5);

        par1.Perimeter();
        par1.Heigth();
        Rhomb rhomb = new Rhomb(2, 2, 4, 3, 3, 4, 5, 5);

        rhomb.Area();
        rhomb.Heigth();
        rhomb.InRadius();
        Console.ReadKey();
    }
Esempio n. 24
0
        public static void LocalCoordinates_Returns_Coordinates_of_Vertices_in_Original_Local_Coordinates()
        {
            Parallelogram parallelogram             = new Parallelogram(height, width, skew);
            IList <CartesianCoordinate> coordinates = parallelogram.LocalCoordinates();

            Assert.AreEqual(0, coordinates[0].X);
            Assert.AreEqual(0, coordinates[0].Y);

            Assert.AreEqual(width, coordinates[1].X);
            Assert.AreEqual(0, coordinates[1].Y);

            Assert.AreEqual(skew + width, coordinates[2].X);
            Assert.AreEqual(height, coordinates[2].Y);

            Assert.AreEqual(skew, coordinates[3].X);
            Assert.AreEqual(height, coordinates[3].Y);
        }
Esempio n. 25
0
        public static void Initialization_with_Dimensions_Creates_Shape()
        {
            Parallelogram parallelogram = new Parallelogram(height, width, skew);

            Assert.AreEqual(4, parallelogram.Points.Count);
            Assert.AreEqual(4, parallelogram.Angles.Count);
            Assert.AreEqual(4, parallelogram.Sides.Count);
            Assert.AreEqual(GeometryLibrary.ZeroTolerance, parallelogram.Tolerance);
            Assert.AreEqual(6.5, parallelogram.Centroid.X, Tolerance);
            Assert.AreEqual(2.5, parallelogram.Centroid.Y, Tolerance);

            Assert.AreEqual(skew, parallelogram.g);
            Assert.AreEqual(height, parallelogram.h);
            Assert.AreEqual(width, parallelogram.b_t);
            Assert.AreEqual(width, parallelogram.b_b);
            Assert.AreEqual(5.830951895, parallelogram.a, Tolerance);
        }
Esempio n. 26
0
        static void Main(string[] args)
        {
            Point A = new Point(0, 0);
            Point B = new Point(0, 8);
            Point C = new Point(8, 0);
            Point D = new Point(8, 8);

            try
            {
                Ellips ellips = new Ellips(A, B, C);
                Console.WriteLine(ellips);

                Circle circle = new Circle(A, C);
                Console.WriteLine(circle);

                Trapeze trapeze = new Trapeze(A, B, C, D);
                Console.WriteLine(trapeze);

                Triangle trianle = new Triangle(A, B, C);
                Console.WriteLine(trianle);

                Parallelogram parallelogram = new Parallelogram(A, B, C, D);
                Console.WriteLine(parallelogram);

                Rectangle rectangle = new Rectangle(A, B, C, D);
                Console.WriteLine(rectangle);

                Rombus rombus = new Rombus(A, B, C, D);
                Console.WriteLine(rombus);

                Square square = new Square(A, B, C, D);
                Console.WriteLine(square);
            }
            catch (ApplicationException e)
            {
                Console.WriteLine(" {0} ", e.Message);
            }
            finally
            {
                Console.WriteLine("\nBy !\n\n\n\n");
            }


            Console.ReadKey();
        }
        private static List <EdgeAggregator> InstantiateTheorem(Parallelogram parallelogram, GroundedClause original)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            // Determine the CongruentSegments opposing sides and output that.
            GeometricCongruentAngles gcas1 = new GeometricCongruentAngles(parallelogram.topLeftAngle, parallelogram.bottomRightAngle);
            GeometricCongruentAngles gcas2 = new GeometricCongruentAngles(parallelogram.bottomLeftAngle, parallelogram.topRightAngle);

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

            antecedent.Add(original);

            newGrounded.Add(new EdgeAggregator(antecedent, gcas1, annotation));
            newGrounded.Add(new EdgeAggregator(antecedent, gcas2, annotation));

            return(newGrounded);
        }
Esempio n. 28
0
    static void Main(string[] args)
    {
        Triangle       triangle1 = new Triangle(1, 1, 3, 2, 2, 4);
        Parallelogram  par1      = new Parallelogram(-1, 1, -3, 2, -2, 4, -4, 5);
        Rhomb          rhomb     = new Rhomb(2, 2, 4, 3, 3, 4, 5, 5);
        List <Polygon> col       = new List <Polygon>();

        col.Add(triangle1);
        col.Add(par1);
        col.Add(rhomb);
        col.Sort();
        Console.WriteLine("Объекты отсортированы по возрастанию поля Ax");
        foreach (Polygon o in col)
        {
            Console.WriteLine(o + " " + o.Ax);
        }
        Console.ReadKey();
    }
Esempio n. 29
0
        void Run()
        {
            var quad1 = new Quadrilateral(2, 3, 4, 5);

            Console.WriteLine($"quad1: perimeter is {quad1.Perimeter()}");

            var pgram1 = new Parallelogram(6, 7);

            Console.WriteLine($"pgram1: perimeter is {pgram1.Perimeter()} and area is {pgram1.Area()}");

            var sqr1 = new Square(10);

            Console.WriteLine($"sqr1: perimeter is {sqr1.Perimeter()} and area is {sqr1.Area()}");

            var tri1 = new Triangle(2, 3, 4);

            Console.WriteLine($"tri1: perimeter is {tri1.Perimeter()}");
        }
Esempio n. 30
0
    static void Main(string[] args)
    {
        Square        square        = new Square(32);
        Rectangle     rectangle     = new Rectangle(24, 8);
        Parallelogram parallelogram = new Parallelogram(3, 5, 20);
        Trapeze       trapeze       = new Trapeze(10, 9, 8, 9);
        Triangle      triangle      = new Triangle(16, 32);

        List <Shape> shapes = new List <Shape>()
        {
            square, rectangle, parallelogram, trapeze, triangle
        };

        for (int i = 0; i < shapes.Count; i++)
        {
            Console.WriteLine(shapes[i].ToString() + ": O = " + shapes[i].GetCircumference() + " | A = " + shapes[i].GetArea());
        }
    }