MATLAB: How to rotate the lines on an image

linematrixplotrotation

Hey everyone I'm having trouble knowing how to rotate lines plotted on my image. I put in my code below.
Below when theta is changed the left axis changes value and the right axis changes value.
clc
%Horizontal lines @ 50 row spacing
a = [1 250];
b = [1 1]+R;
c = [50 50]+R;
d = [100 100]+R;
e = [150 150]+R;
f = [200 200]+R;
g = [250 250]+R;
%Rotation Matrix

theta = 0
R = [(+theta) (-theta)]
%Rotation of plots
Ha = [a;a];
Hb = [a;b];
Hc = [a;c];
Hd = [a;d];
He = [a;e];
Hf = [a;f];
Hg = [a;g];
%Rotation Matrix
P = phantom(250);
imshow(P)
hold on
plot(Hb',Ha'),plot(Hc',Ha'),plot(Hd',Ha'),plot(He',Ha'),plot(Hf',Ha'),plot(Hg',Ha')
plot(Ha',Hb'),plot(Ha',Hc'),plot(Ha',Hd'),plot(Ha',He'),plot(Ha',Hf'),plot(Ha',Hg')
hold off

Best Answer

You can use code similar to that below. I changed the step size to 30 degrees to make it more clear what is happening.
clc
center=[120,120];%xy center of polygons
r_inner=20;%distance to center from inner polygon
r_pad=50;%distance between parallel lines
I=phantom(250);%random image
r_outer=r_inner+r_pad;
theta=0:30:360;
[x1,y1]=pol2cart(deg2rad(theta),r_inner);
[x2,y2]=pol2cart(deg2rad(theta),r_outer);
figure(1),clf(1)
imshow(I)
hold on
plot(x1+center(1),y1+center(2))
plot(x2+center(1),y2+center(2))
hold off