#include #include #include "prog04header.h" /* prog04_4.c */ double CalcArea( Triangle triangle ){ XY p1, p2; double crsProduct, area; p1.x = triangle.vertex[1].x - triangle.vertex[0].x; p1.y = triangle.vertex[1].y - triangle.vertex[0].y; p2.x = triangle.vertex[2].x - triangle.vertex[0].x; p2.y = triangle.vertex[2].y - triangle.vertex[0].y; crsProduct = p1.x * p2.y - p1.y * p2.x; area = fabs( crsProduct ) / 2.0; return area; }