예제 #1
0
 private void CalculatePerimeter()
 {
     for (int i = 0; i < nodes.Count - 1; i++)
     {
         perimeter += Edge.Length(nodes[i], nodes[i + 1]);
     }
     perimeter += Edge.Length(nodes[nodes.Count - 1], nodes[0]);
 }
예제 #2
0
        public Triangle(Point first, Point second, Point third)   // Constructor
        {
            a = first;
            b = second;
            c = third;
            double e1 = Edge.Length(a, b);
            double e2 = Edge.Length(b, c);
            double e3 = Edge.Length(a, c);

            if (e1 + e2 <= e3 || e1 + e3 <= e2 || e3 + e2 <= e1)
            {
                throw new ArgumentException("incorrect coordinates");
            }
            Edge ab = new Edge(first, second);
            Edge bc = new Edge(second, third);
            Edge ac = new Edge(first, third);

            CalculateArea(e1, e2, e3);
            CalculatePerimeter(e1, e2, e3);
            CalculateIsosceles(e1, e2, e3);
            CalculateRight(e1, e2, e3);
        }