The area of a triangle whose three vertices are points (x1. y1), (x2, y2), and (
ID: 3655157 • Letter: T
Question
The area of a triangle whose three vertices are points (x1. y1), (x2, y2), and (x3, y3) (see Figure 6.6) can be found from the equation where || is the determinant operation. The area returned will be positive if the points are taken in counterclockwise order and negative if the points arc taken in clockwise order. This determinant can be evaluated by hand Co produce (he following equation A = 1/2[x1(y2 - y3) - x2(y1 - y3) + x3(y1 - y2)] (6.13) Write a function area 2d that calculates the area of a triangle, given the three bounding pointsExplanation / Answer
double area2d(double x1,double y1,double x2,double y2,double x3,double y3) { return (1/2.0)*((x1*(y2-y3))-(x2*(y1-y3))+(x3*(y1-y2))); }