How can I draw a special circle separated by two colors?
Show older comments
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
on 26 Oct 2012
0 votes
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
Haksun Lee comments:
"Thank you for your reply..
As you mentioned, I will change shape of special circle through communication. The end point of special circle will change according to current speed data. I assume that MATLAB receives speed data [150 100 50] through serial communication, and then the end point of special circle will change to location 150 -> 100 -> 50 like odometer. I'd like to draw special circle in MATLAB because the shape will change from run to run. I don't care about parameter if special circle can be drawn in MATAB Code.
I am waiting for your advice sincerely."
Image Analyst
on 26 Oct 2012
Edited: Image Analyst
on 26 Oct 2012
Can the rest of the image be assumed to be already constructed and read in as an image, so that only the gray and white arcs need to be added? Have you already attempted anything like the samples given in the FAQ?
Haksun Lee
on 26 Oct 2012
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.
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!