MATLAB: Dividing a circle into six equal parts

circledigital image processingimage processingmathematics

hello
can you please help me…i have a mask image for the LV (left ventricle) that is two concentric circles,inside these circles ones and outside them zeros…anyway i just wanna divide this circle into six equal parts (each 60 degrees) given the starting point (which i call "the insertion point")…. can you please help me
if you need more info just ask me
thank you in advance

Best Answer

You could write a custom function to do this:
function P = plot_arc(a,b,h,k,r)
% Plot a circular arc as a pie wedge.
% a is start of arc in radians,
% b is end of arc in radians,
% (h,k) is the center of the circle.
% r is the radius.
% Try this: plot_arc(pi/4,3*pi/4,9,-4,3)
% Author: Matt Fig
t = linspace(a,b);
x = r*cos(t) + h;
y = r*sin(t) + k;
x = [x h x(1)];
y = [y k y(1)];
P = fill(x,y,'r');
axis([h-r-1 h+r+1 k-r-1 k+r+1])
axis square;
if ~nargout
clear P
end
Now from the command line:
hold on
for ii = 1:6
P(ii) = plot_arc(pi/3*(ii-1),pi/3*(ii),9,-4,3);
end
If this doesn't do it, consider using the LINE function. For example, replace this line:
P = fill(x,y,'r');
with this:
P = line(x,y);
and possibly delete the calls to the AXIS function.