%Scott Mueller
%3/10/09
%getShape.m
%Description: Passed a perimeter and area of an object to be classified.
%Calculates the ratio of the area/perimeter and checks it against a table.
%If the ratio is within the domain [shapeTable(1,i),shapeTable(2,i)) then
%the corresponding shape name is specified by shapeNames(i). The table
%values are determined experimentally by the user. Additional shapes can
%be added as well
function shape = getShape (perimeter, area)
shapeCount = 3; %# of different shapes
shapeTable = zeros(3,shapeCount);
shapeTable = [10, 8.2, 6; 14,9, 8.2]; % lower bound inclusive; upper bounds exclusive;
shapeNames =['rect';'circ';'tria']; %shape names
tempSize = size(shapeTable);
increment =.01;
shape = 'ukwn'; %default shape
apRatio = area/perimeter;
for i=1:tempSize(1,2);
if (apRatio >= shapeTable(1,i)) && (apRatio < shapeTable(2,i))
shape = shapeNames(i,:);
end
end
end