#include "triangle.h"
#include"point.h"
#include<cmath>
using namespace std;
Triangle::Triangle(const Point &p1,const Point &p2,const Point &p3)
:p1(p1),p2(p2),p3(p3)
{
}
double Triangle::getArea()const
{
double d1,d2,d3;
d1=p1.getDistance(p2);
d2=p2.getDistance(p3);
d3=p3.getDistance(p1);
double half=(d1+d2+d3)/2;
double area=sqrt(half*(half-d1)*(half-d2)*(half-d3));
return area;
}
double Triangle::getPerimeter()const
{
double d1,d2,d3;
d1=p1.getDistance(p2);
d2=p2.getDistance(p3);
d3=p3.getDistance(p1);
double perimeter=d1+d2+d3;
return perimeter;
}