Ejemplo n.º 1
0
 public override double Perimeter()
 {
     return
         (Point.DistanceBetween(points[0], points[1]) +
          Point.DistanceBetween(points[1], points[2]) +
          Point.DistanceBetween(points[2], points[0]));
 }
Ejemplo n.º 2
0
        public static Double TriangleArea(Point A, Point B, Point C)
        {
            Double a = Point.DistanceBetween(B, C);
            Double b = Point.DistanceBetween(A, C);
            Double c = Point.DistanceBetween(B, A);
            Double p = (a + b + c) / 2.0;

            Double tmp = p * (p - a) * (p - b) * (p - c);

            if (tmp < 0)
            {
                throw new ArgumentOutOfRangeException("Wrong triangle");
            }

            return(Math.Sqrt(tmp));
        }