X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_particle%2Frandom.cpp;h=ebdff92474e481d874f4638ee40e9f282790ce6c;hb=4d2cf011c73551bbe67518097063e22ecdac7c7c;hp=c72c76343eed08cb0075528fa080a5e2d0afba55;hpb=14c4d99cbeedaba4c2f13bf8256458e326a8ecf3;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_particle/random.cpp b/synfig-core/trunk/src/modules/mod_particle/random.cpp index c72c763..ebdff92 100644 --- a/synfig-core/trunk/src/modules/mod_particle/random.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/random.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -37,6 +38,8 @@ /* === M A C R O S ========================================================= */ +#define PI (3.1415927) + /* === G L O B A L S ======================================================= */ /* === P R O C E D U R E S ================================================= */ @@ -57,6 +60,10 @@ Random::set_seed(int x) t_mask=rand()+rand()*RAND_MAX; } +// this picks one of the POOL_SIZE (256) preset values out of the pool +// and scales it to be in the range (-1, 1). is that what it was +// intended to do? the distribution is pretty terrible, too, with +// some elements being picked a hundred times more often than others float Random::operator()(const int salt,const int x,const int y,const int t)const { @@ -219,8 +226,8 @@ Random::operator()(SmoothType smooth,int subseed,float xf,float yf,float tf)cons int y((int)floor(yf)); float a=xf-x; float b=yf-y; - a=(1.0f-cos(a*3.1415927))*0.5f; - b=(1.0f-cos(b*3.1415927))*0.5f; + a=(1.0f-cos(a*PI))*0.5f; + b=(1.0f-cos(b*PI))*0.5f; float c=1.0-a; float d=1.0-b; int x2=x+1,y2=y+1; @@ -236,12 +243,12 @@ Random::operator()(SmoothType smooth,int subseed,float xf,float yf,float tf)cons float b=yf-y; float c=tf-t; - a=(1.0f-cos(a*3.1415927))*0.5f; - b=(1.0f-cos(b*3.1415927))*0.5f; + a=(1.0f-cos(a*PI))*0.5f; + b=(1.0f-cos(b*PI))*0.5f; // We don't perform this on the time axis, otherwise we won't // get smooth motion - //c=(1.0f-cos(c*3.1415927))*0.5f; + //c=(1.0f-cos(c*PI))*0.5f; float d=1.0-a; float e=1.0-b;