We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Distinguish Overlapping Ellipses
Page Index Toggle Pages: 1
Distinguish Overlapping Ellipses (Read 590 times)
Distinguish Overlapping Ellipses
Mar 26th, 2010, 3:51pm
 
I'm writing a program where I want users to select or deselect items on the screen. When I had a few objects it was relatively easy to decipher hit areas using this method:

Code:

   float disX = p.position().x() - mouseX;
   float disY = p.position().y() - mouseY;
   if (sqrt(sq(disX) + sq(disY)) < w/2 ) {
     isPressed  = true;
   }


...
http://jonobr1.com/code/brainMap/

However, when I try to set it up with the actual number of objects I'm going to use it becomes rather difficult to hit just one area. Is there a way to compare which item is drawn on top so that I can only click on one ellipse at a time

...
http://jonobr1.com/code/mindMap
Re: Distinguish Overlapping Ellipses
Reply #1 - Mar 26th, 2010, 4:13pm
 
even if you check which is on top. how would you ever click on the ones below you can use a library like traerphysics to easily keep them apart.
http://www.cs.princeton.edu/~traer/physics/
his example shows somehow what i mean and could be edited http://www.cs.princeton.edu/~traer/physics/random_arboretum/index.html

no matter how you do it, this example  for layer management using registerDraw by blindfish should be really useful
http://www.openprocessing.org/visuals/?visualID=6890
Re: Distinguish Overlapping Ellipses
Reply #2 - Mar 26th, 2010, 4:31pm
 
Thanks for the quick response Cedric. I am using Traer Physics right now to separate them (basically giving a negative attraction from all ellipses to all other ellipses). But, it becomes difficult with so many ellipses and the constraints of the screen that I don't think I could simply just push them apart...I'll have to keep looking into this though. At the moment you can delete an ellipse by right clicking it. I think this would give a sense of "digging." You'd have to delete some to get to the bottom ones.

That layer management on OpenProcessing is incredible! Just what I was looking for.
Re: Distinguish Overlapping Ellipses
Reply #3 - Mar 26th, 2010, 4:52pm
 
yes, i thought so. cause bringing them to the background makes much more sense then deleting them. i guess thats the way to go. good luck and let us know how it turned out
Re: Distinguish Overlapping Ellipses
Reply #4 - Mar 27th, 2010, 10:12am
 
It is quite some work, but I suggest to work on a virtual screen, ie. let the ellipses go beyond the screen. With user movements (translation, zoom in/out), it would be easier to navigate in your complex network and to distinguish elements in it.
Page Index Toggle Pages: 1