%% Rotate Square
% Create a square, polyin, and rotate it 45 degrees counterclockwise with respect to the point (0,0).

polyin = polyshape([0 0 1 1],[1 0 0 1]);
poly1 = rotate(polyin,45);

%
% Rotate polyin 45 degrees with respect to the point (1,0).

poly2 = rotate(polyin,45,[1 0]);

%
% Plot all three polygons.

plot([polyin poly1 poly2])
axis equal

% Copyright 2012 The MathWorks, Inc.