필터 지우기
필터 지우기

dividing a circle into six equal parts

조회 수: 7 (최근 30일)
Lamis
Lamis 2011년 5월 12일
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

채택된 답변

Matt Fig
Matt Fig 2011년 5월 12일
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.

추가 답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 5월 12일
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
ajith
ajith 2013년 8월 21일
sir i found the centroid using regionprops how to pick three angles at 60 degree spacing.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2011년 5월 12일
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!

Translated by