예제 #1
0
        private void DrawEllipse(EllipseInfo e)
        {
            var ell = new System.Windows.Shapes.Ellipse();

            ell.StrokeThickness = 2;
            ell.Stroke          = Brushes.Black;
            Shapes.Ellipse myEll = new Shapes.Ellipse(new Vec2f(e.f1[0], e.f1[1]),
                                                      new Vec2f(e.f2[0], e.f2[1]), e.bigO);
            ell.Height = myEll.a * 2 * 100;
            ell.Width  = myEll.b * 2 * 100;

            panel.Children.Add(ell);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Point centreRect = new Point(1, 1);
            Point centreSquare = new Point(0, 0);

            Rectangle rect = new Rectangle(3, 5, centreRect);
            Square square = new Square(2, centreSquare);
            Ellipse ellipse = new Ellipse(2, 1, centreSquare);

            Console.WriteLine(rect.ToString());
            Console.WriteLine(rect.GetArea() + " " + rect.GetPerimeter());

            Console.WriteLine(square.ToString());
            Console.WriteLine(square.GetArea() + " " + square.GetPerimeter());

            Console.WriteLine(ellipse.ToString());
            Console.WriteLine(ellipse.GetArea() + " " + ellipse.GetPerimeter());
        }
예제 #3
0
        public static void Main()
        {
            var shapes = new List<Shape>();
            var square = new Square(10);
            var rectangle = new Rectangle(5.5, 6.5);
            var triangle = new Triangle(new Point(1, 5), new Point(3, 7), new Point(8, 3));
            var ellipse = new Ellipse(3, 7);
            var circle = new Circle(5.5);
            shapes.Add(circle);
            shapes.Add(ellipse);
            shapes.Add(triangle);
            shapes.Add(rectangle);
            shapes.Add(square);

            foreach (var shape in shapes)
            {
                Console.WriteLine(shape.ToString());
                Console.WriteLine();
            }
        }
예제 #4
0
 static void Main(string[] args)
 {
     Point p1 = new Point(1, 2);
     Point p2 = new Point(5, 1);
     Point p3 = new Point(3, 5);
     Point p4 = new Point(1, 5);
     Triangle triangle = new Triangle(p1, p2, p3);
     //Console.WriteLine(triangle.GetArea());
     //Console.WriteLine(triangle.GetPerimeter());
     Console.WriteLine(triangle.ToString());
     Ellipse ellipse = new Ellipse(5, 10);
     //Console.WriteLine(ellipse.GetPerimeter());
     //Console.WriteLine(ellipse.GetArea());
     Console.WriteLine(ellipse.ToString());
     Rectangle rectangle = new Rectangle(p1,p2,p3,p4);
     //Console.WriteLine(rectangle.Width);
     //Console.WriteLine(rectangle.Heigth);
     //Console.WriteLine(rectangle.GetArea());
     //Console.WriteLine(rectangle.GetPerimeter());
     Console.WriteLine(rectangle.ToString());
 }