How can I count the number of particles crossing a line or entering a region?
I am trying to do a very simplified animation about diffusion with flux through a membrane. So basically I have been able to make a number of points that move randomly from one region R1 to another region R2.
I have been trying to figure out how to track the number of particles crossing the border between R1 and R2 in a period of time. My goal is to create a plot time versus number of particles crossing the border.
So the question is: How can I keep track of the the number of particles crossing a line or entering a region? (Please, see file attached with what I have done so far...)
Any help or suggestions would be appreciated.