From d65b91054ec401dc3188d615fe2f5c0581b105c9 Mon Sep 17 00:00:00 2001 From: dooglus Date: Sat, 5 Apr 2008 20:22:47 +0000 Subject: [PATCH] Fix a bug in the plant layer: when the plant is so small that we can't calculate the perpendicular to its bline, skip trying to branch it. git-svn-id: http://svn.voria.com/code@1962 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/modules/mod_particle/plant.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.cpp b/synfig-core/trunk/src/modules/mod_particle/plant.cpp index 1cc6dc0a..60652a46 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -241,6 +241,9 @@ Plant::sync()const if((((i+1)*sprouts + steps/2) / steps) > branch_count) { Vector branch_velocity(deriv(f).norm()*velocity + deriv(f).perp().norm()*perp_velocity); + if (isnan(branch_velocity[0]) || isnan(branch_velocity[1])) + continue; + branch_velocity[0] += random_factor * random(Random::SMOOTH_COSINE, 1, f*splits, 0.0f, 0.0f); branch_velocity[1] += random_factor * random(Random::SMOOTH_COSINE, 2, f*splits, 0.0f, 0.0f); -- 2.11.4.GIT