How can I draw a special circle separated by two colors?

6 views (last 30 days)
Haksun Lee
Haksun Lee on 25 Oct 2012
Hi all.. I knew how to draw a complete circle separated by two color through asking question as following.
c=1+2j % circle centre
r=4 % radius
x=real(c)-r:0.01:real(c)+r
y1=sqrt(r^2-(x-real(c)).^2)+imag(c)
plot(x,y1,'r')
hold on
plot(x,-y1+2*imag(c),'b')
axis square
Ultimately, I am planning to draw two colored circles (including gray, white) of following picture.
Which code can I use to draw special circle?
I'd like to accept advice or idea from many people as far as possible.

Answers (1)

Image Analyst
Image Analyst on 26 Oct 2012
I'd do it in Photoshop and then just read it in as an image. Why do it the hard way like trying to recreate it via MATLAB? You haven't said if any of your parameters will change from run to run, so I'm assuming that they won't and they'll just use the constant values you gave, like radius = 4, etc. If any of them need to change on a run-by-run basis you should have / would have said so. So that's why I say to use Photoshop (or GIMP or Paint).
  4 Comments
Image Analyst
Image Analyst on 26 Oct 2012
try doing the inner and outer arcs then using poly2mask to get a binary image of the center of the arc filled in. Then apply the mask to the image
arcImage = poly2mask(coords, rows, columns);
grayImage(arcImage) = 200; % or whatever value the color gray is.
or something like that.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!