How to optimally radiate a quantity to surroundings (in 3D)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By toblin

I have biological cells represented by spheres in 3D. They are meant to replicate, stick to each other, die, and transfer molecules with nearby cells. Running my code has revealed that my current implementation for transferring molecules is taking quite a lot of time. I’m therefore looking for ideas that might be more optimized.

If you have thousands of instances of spherical objects in 3D space, what would be the most efficient way of transferring information between objects that are within a user-defined distance of each other?

Imagine that each cell releases the molecules into its surrounding environment that then become less concentrated as you get further from the source cell. The cells in its environment will absorb those molecules, depending on the distance to the source cell.

My current implementation
In my implementation thus far, the cells have amounts of certain molecules that are represented by float values in a dictionary. Currently each cell has a transmission Area that detects when other cells are nearby. They then then transmit an amount by reducing their own value and increase that of the receiver.

Other ideas

  • Particles that each cell can send out uniformly that then hit other cells
  • Ray-casting: each cell “shooting” rays uniformly that then hit other cells