Link to home
Create AccountLog in
Avatar of Member_2_2394978
Member_2_2394978Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Drawing 'linked' circles

Hi All,

At the moment I am using http://www.mathworks.com/matlabcentral/fileexchange/2876 to draw many circles on one figure. The circles belong to many different classes, lets say 5, so i'm drawing each circle in a colour defining which class it comes from (see image before, just two classes here, so two colours).
What I want to do is some how link where they overlap, such like in image after. So where they overlap to remove the overlapping bits, but not if overlapped! Hopefully this will simply by, at current, very complicated plot!

Any suggestions?
Cheers
James
before.png
after.png
Avatar of yuk99
yuk99
Flag of United States of America image

Your question description and figures are confusing a little. As I understand from figures, you want to get circles of one class (let's say black ones) and remove segments where they intersect. Then do the same for another class (red) independently of the first class (in your case red circles do not intersect, so you don't remove anything for them). Am I correct?

If you are using the CIRCLE function to draw the circles, I suppose you still have variables like radius, centers coordinates, axes handles, right? Please confirm and I will send you  a code.
Avatar of DanRollins
It seems to me that you could use
   CreateEllipticRgn
   http://msdn.microsoft.com/en-us/library/dd183496(VS.85).aspx
for each circle, then use Region API functions as CombineRgn
   Region Functions
   http://msdn.microsoft.com/en-us/library/dd162915(VS.85).aspx
or GDI+ Region functions such as Region::Intersect
    Region Class
    http://msdn.microsoft.com/en-us/library/ms534501(VS.85).aspx
to do the heavy lifting.
ASKER CERTIFIED SOLUTION
Avatar of yuk99
yuk99
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Original file names were with underscores, not dashes. It get changed after upload. EE bug? Rename dashes to upderscores, especially for the function file.
Avatar of Member_2_2394978

ASKER

Thanks, I shall have a look at all suggestions and get back to you today :)
Wonderful thank you.