Code covered by the BSD License  

Highlights from
Contour Correspondence via Ant Colony Optimization

image thumbnail
from Contour Correspondence via Ant Colony Optimization by Oliver van Kaick
Computes a correspondence between two shapes based on ant colony optimization (ACO).

signed_triangle_area(A, B, C)
%
% This function returns the *signed* area of a triangle
% ABC in 2D. Crosss product is used.
%
% a = signed_triangle_area(A, B, C)
%
% Assume that A, B, and C are given in counterclockwise order.
%
% ------------------------------------------------------
% (C) Richard (Hao) Zhang (2005)
%
function a = signed_triangle_area(A, B, C)
u = B - A;
v = C - A;

cp = cross([u 0], [v 0]);
a = sign(cp(1,3)) * 0.5 * norm(cp);

Contact us at files@mathworks.com