Simulation Programming: Spawning particles at random position

AI Thread Summary
The discussion revolves around a simulation project using Breve, where the user is trying to spawn spherical particles with random radii in a designated area without overlapping. The initial brute force method involves checking the distance between new and existing particles to ensure they do not overlap, which is effective but inefficient, especially with a large number of particles, leading to long processing times and potential program crashes. To improve efficiency, the user seeks a method to initially select a random position for new particles and, if overlaps occur, quickly find a new position that does not intersect with existing spheres. This approach aims to reduce the number of checks and enhance the program's performance.
PythagoreLove
Messages
19
Reaction score
0
Hi, I am making a program with the simulation software Breve. It codes in Python or in Steve (their own language). In my simulation, spherical particle with random radius are being spawned at random position into a little zone. My problem is that those particle cannot be superposed. I don't know how to program it in such a way that the particle will spawn at a position where they will touch no other particle.


Thanks
PytLove
 
Technology news on Phys.org
Simple brute force method:

For each new particle check to see the distance between the center of the particle and the center of each previous particle is greater than the sum of the radius of each of those two particles. If it isn't then throw the new one away and generate another particle.
 
Thank you that seems to work well. Unfortunately that takes a long time with a lot of sphere and sometimes the program crash because the loop verifying the sphere position run for too much time. I would like to at first take a random position, and if it touches another sphere choose a position where there is nothing. In that way one sphere could not be spawned more than two times. I don't know if it's possible but I think that could make my program faster.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Back
Top