heyy, i want to divise an image with matrix rotation to 6 segments (theta=60degrees),the point is to incrimente a new segment with the last segment (by theta=theta+pi/3).can u help me please
x = 1:5;y = 1:5;v = [x;y];x_center = x(3);y_center = y(3);center = repmat([x_center; y_center], 1, length(x));theta = pi/3; mod(theta,360)R = [cos(theta) -sin(theta); sin(theta) cos(theta)];s = v - center; so = R*s; vo = so + center; x_rotated = vo(1,:);y_rotated = vo(2,:);plot(x, y, 'k-', x_rotated, y_rotated, 'r-', x_center, y_center, 'bo');axis equalx_rotated = 1:5;y_rotated = 1:5;v1 = [x_rotated;y_rotated];x1_center = x_rotated(3);y1_center = y_rotated(3);center1 = repmat([x1_center; y1_center], 1, length(x_rotated));theta1=theta+pi/3;R1 = [cos(theta1) -sin(theta1); sin(theta1) cos(theta1)];s1 = v1 - center1; so1 = R1*s1; vo1 = so1 + center1; x1_rotated = vo1(1,:); y1_rotated = vo1(2,:);plot(x_rotated, y_rotated, 'k-', x1_rotated, y1_rotated, 'b-', x1_center, y1_center, 'bo');axis equal
the problem in my code that he couldn't show the first segment with 60degrees,it shows only the last one with 120degrees
Best Answer