This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Function to generate random 3D points within a defined space | |
| initialize_swarm = function(n=100, range=10) { | |
| swarm = matrix(runif(n * 3, -range, range), ncol=3) | |
| velocities = matrix(runif(n * 3, -0.1, 0.1), ncol=3) | |
| list(swarm=swarm, velocities=velocities) | |
| } | |
| spinning_vector_field = function(swarm, spin_strength=0.05) { | |
| #Swirl around the Z-axis |