#include "Triangle.h"

using namespace std;

Tri::Tri()
{
        vertex v1;
        v1.x = 0.0;
        v1.y = 0.0;
        v1.z = 0.0;
        vertex v2;
        v2.x = 0.0;
        v2.y = 0.0;
        v2.z = 0.0;
        vertex v3;
        v3.x = 0.0;
        v3.y = 0.0;
        v3.z = 0.0;
        v.push_back(v1);
        v.push_back(v2);
        v.push_back(v3);
        xmin = 0;
        xmax = 0;
        ymin = 0;
        ymax = 0;
        area = 0.0;
}

float findArea(vertex &one, vertex &two, vertex &three)
{
        return abs(one.x*two.y + two.x*three.y + three.x*one.y - one.y*two.x - two.y*three.x - three.y*one.x)/2.0;
}

Tri::Tri(vertex &one, vertex &two, vertex &three)
{
        v.push_back(one);
        v.push_back(two);
        v.push_back(three);
        xmin = one.x;
        xmax = one.x;
        ymin = one.y;
        ymax = one.y;
        area = findArea(one, two, three);
}

