1 function a = area_triangle(q, p1, p2)
2 %
function a = area_triangle(q, p1, p2)
4 %
function computing the signed (!) area of the triangle q,p1,p2.
5 % is positive, if q,p1,p2 is counterclockwise, is negative, if
6 % q,p1,p2 is clockwise ordered.
8 % If q,p1,p2 is a matrix with rowwise points, then a vector of
11 % Bernard Haasdonk 10.5.2007
25 if (size(p1,2)~=2) || (size(p2,2)~=2) || (size(q,2)~=2)
26 error('Only 2d points acceptable in area computation');
29 %a = zeros(size(p1,2),1);
31 % a = 0.5 * | Det (p1-q , p2-q) |
38 a = 0.5 * (a11.*a22 - a21.*a12);