Example #1
0
        private void drawTriangle(Triangle triangle)
        {
            Line line = new Line();

            line.Stroke = Brushes.Red;
            Line line1 = new Line();

            line1.Stroke = Brushes.Red;
            Line line2 = new Line();

            line2.Stroke = Brushes.Red;

            line.X1 = triangle.getPoint1().getX();
            line.Y1 = triangle.getPoint1().getY();
            line.X2 = triangle.getPoint2().getX();
            line.Y2 = triangle.getPoint2().getY();
            MainCanvas.Children.Add(line);

            line1.X1 = triangle.getPoint2().getX();
            line1.Y1 = triangle.getPoint2().getY();
            line1.X2 = triangle.getPoint3().getX();
            line1.Y2 = triangle.getPoint3().getY();
            MainCanvas.Children.Add(line1);

            line2.X1 = triangle.getPoint3().getX();
            line2.Y1 = triangle.getPoint3().getY();
            line2.X2 = triangle.getPoint1().getX();
            line2.Y2 = triangle.getPoint1().getY();
            MainCanvas.Children.Add(line2);
        }
Example #2
0
 private void drawTriangle(Triangle triangle)
 {
     drawLine(triangle.getPoint1(), triangle.getPoint2());
     drawLine(triangle.getPoint2(), triangle.getPoint3());
     drawLine(triangle.getPoint3(), triangle.getPoint1());
 }