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 › particle repulsion
Page Index Toggle Pages: 1
particle repulsion (Read 1253 times)
particle repulsion
Nov 6th, 2009, 7:03am
 
hello guys,
   sorry for making such a non-specific question,
but last days I've been looking for a good way to implement a repulsion algorithm.So I would like to have a particle that would move back when it hits to against another particle, or even better when I hit it with my mouse pointer.
if somebody can link me to a site with solutions to such problems that would be also welcome.
thanks in advance

peace
Re: particle repulsion
Reply #1 - Nov 6th, 2009, 7:56am
 
Maybe there's two things: repulsion and collisions.

(repulsion)
Is based on spring and particles. There's no collisions in itself, it's an emergent behavior out of the repulsions. You may set your system to behave like every particles are avoiding each others.
http://www.cs.princeton.edu/~traer/physics
http://processing.org/discourse/yabb2/num_1139193613.html

(collision detection)
In this case, you detect if to shapes collides. Usually, it's simpler when you are using circles or spheres (you just have to calculate the distance between centers. It's more complex with arbitrary shapes.
http://processing.org/hacks/hacks:collision_detection
http://processing.org/discourse/yabb/YaBB.cgi?num=1113770101
http://processing.org/discourse/yabb2/?num=1190236595
Re: particle repulsion
Reply #2 - Nov 6th, 2009, 10:22am
 
thanks pal I'll check it out
Page Index Toggle Pages: 1