dividing a circle into six equal parts

9 views (last 30 days)
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

Accepted Answer

Matt Fig
Matt Fig on 12 May 2011
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.

More Answers (2)

Sean de Wolski
Sean de Wolski on 12 May 2011
Hmmm. A rambling of one way to do it, given a logical map of a circle:
  • Find the centroid.
  • Pick three angles at 60 degree spacing, Eg: 0:60:120 degrees
  • Translate these to slopes
  • Find appropriate intercepts such that a line with each of those slopes runs through the centroid.
  • Turn these lines to black in your map.
  • Use bwlabel to label the six sextets. Turn the lines back on so that each half of one line (halves defined cut at the centroid) is a number 1-6 adjacent to one of the sextets of the same number.
There are probably better ways but this should work.
  1 Comment
ajith
ajith on 21 Aug 2013
sir i found the centroid using regionprops how to pick three angles at 60 degree spacing.

Sign in to comment.


Walter Roberson
Walter Roberson on 12 May 2011
What relationship is the point to have to the divisions ? Is there an implication that the tangent to the inner circle and outer circle should pass through the selected point? If so, then if you subtract the origin of the circle from the selected point and cart2pol() the result, the angle will give you the rotation offset for the 60 degree (Pi/3) divisions. Add it to (0:5)*Pi/3 and pol2cart() once with the inner radius and once with the outer radius to get the (x,y) coordinates of the endpoints of the dividing segments.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!