Possible fix for [#26190] Changing particle amount crashes

* In some cases fluid particles could be born at the exact same locations. Now these cases are just ignored and such particles don't effect each other.
This commit is contained in:
Janne Karhu 2011-02-23 10:42:27 +00:00
parent 9416daf97e
commit 5a70edc4af
1 changed files with 8 additions and 0 deletions

View File

@ -2286,6 +2286,10 @@ static void particle_fluidsim(ParticleSystem *psys, int own_psys, ParticleData *
/* pressure and near pressure */
for(n=own_psys?1:0; n<neighbours; n++) {
/* disregard particles at the exact same location */
if(ptn[n].dist < FLT_EPSILON)
continue;
sub_v3_v3(ptn[n].co, pa->prev_state.co);
mul_v3_fl(ptn[n].co, 1.f/ptn[n].dist);
q = ptn[n].dist/h;
@ -2305,6 +2309,10 @@ static void particle_fluidsim(ParticleSystem *psys, int own_psys, ParticleData *
/* main calculations */
for(n=own_psys?1:0; n<neighbours; n++) {
/* disregard particles at the exact same location */
if(ptn[n].dist < FLT_EPSILON)
continue;
npa = psys->particles + ptn[n].index;
rij = ptn[n].dist;