pol*_*lux 5 c++ opengl performance
我正在研究一个(c ++,opengl)项目,我需要有很多影响彼此的粒子,如果我是正确的,这被称为nbody问题.有人知道这样的算法有什么解决方案.
我知道barnes hut算法,也许我可以偷看openCL,虽然我不仅仅想知道你是否可以使用其他解决方案.
我将创建的代码有很多:
for(int i = 0; i < num_particles; ++i) {
for(int j = i+1, j < num_particles; ++j)
dist = distance(particles[i],particles[j]);
if(dist > limit) {....}
}
}
Run Code Online (Sandbox Code Playgroud)
亲切的问候,Pollux