function area = triangle_area_2d ( t )
%*****************************************************************************80
%
%% TRIANGLE_AREA_2D computes the area of a triangle in 2D.
%
% Discussion:
%
% If the triangle's vertices are given in counterclockwise order,
% the area will be positive. If the triangle's vertices are given
% in clockwise order, the area will be negative!
%
% An earlier version of this routine always returned the absolute
% value of the computed area. I am convinced now that that is
% a less useful result! For instance, by returning the signed
% area of a triangle, it is possible to easily compute the area
% of a nonconvex polygon as the sum of the (possibly negative)
% areas of triangles formed by node 1 and successive pairs of vertices.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 17 October 2005
%
% Author:
%
% John Burkardt
%
% Input:
%
% real T(2,3), the triangle vertices.
%
% Output:
%
% real AREA, the area of the triangle.
%
area = 0.5 * ( ...
t(1,1) * ( t(2,2) - t(2,3) ) ...
+ t(1,2) * ( t(2,3) - t(2,1) ) ...
+ t(1,3) * ( t(2,1) - t(2,2) ) );
return
end