1 function P=MakeContourClockwise2D(P)
\r
2 % This function MakeContourClockwise will make a contour clockwise
\r
3 % contour clockwise. This is done by calculating the area inside the
\r
4 % contour, if it is positive we change the contour orientation.
\r
6 % P=MakeContourClockwise2D(P);
\r
8 % Function is written by D.Kroon University of Twente (July 2010)
\r
10 % Area inside contour
\r
12 area = 0.5*sum((O((1:size(P,1))+1,1) .* (O((1:size(P,1))+2,2) - O((1:size(P,1)),2))));
\r
14 % If the area inside the contour is positive, change from counter-clockwise to
\r
16 if(area>0), P=P(end:-1:1,:); end
\r