In examples/fireworks/main.rs, I believe explosion_direction is not sampled uniformly on the 3d sphere, resulting in non-uniform initial velocities of particles
Here is the result of the current sampling (I increased the number of particles to make it clearer):
In
examples/fireworks/main.rs
, I believeexplosion_direction
is not sampled uniformly on the 3d sphere, resulting in non-uniform initial velocities of particlesHere is the result of the current sampling (I increased the number of particles to make it clearer):
The code I suggest returns the following:
The idea is to sample
theta
inarcos(unif(-1, 1))
instead ofunif(0, pi)
. More details can be found here: https://stats.stackexchange.com/a/232256