public class Triangle
{
  public static double perimeter(Point a, Point b, Point c)
  {
    Point[] verts = {a,b,c};
    double p = 0;
    for(int i = 0; i < verts.length; i++)
    {
      Point A = verts[i].clone(), B = verts[(i+1)%verts.length].clone();
      A.subtractBy(B);
      p += A.getRadius();
    }
    return p;
  }

  public static double area(Point a, Point b, Point c)
  {
    Point[] verts = {a,b,c};
    double s = perimeter(a,b,c)/2.0;
    double prod = s;
    for(int i = 0; i < verts.length; i++)
    {
      Point A = verts[i].clone(), B = verts[(i+1)%verts.length].clone();
      A.subtractBy(B);
      prod *= (s - A.getRadius());
    }
    return Math.sqrt(prod);
  }

  public static void main(String[] args)
  {
    Point a = new Point(0,0), b = new Point(1,0), c = new Point(1,1);
    System.out.println(perimeter(a,b,c));
    System.out.println(area(a,b,c));
  }
}