LLVector3 LLWind::getVelocityNoisy(const LLVector3 &pos_region, const F32 dim) { static const LLCachedControl<bool> wind_enabled("WindEnabled",false); if(!wind_enabled) { return LLVector3(0.f, 0.f, 0.f); } // Resolve a value, using fractal summing to perturb the returned value LLVector3 r_val(0,0,0); F32 norm = 1.0f; if (dim == 8) { norm = 1.875; } else if (dim == 4) { norm = 1.75; } else if (dim == 2) { norm = 1.5; } F32 temp_dim = dim; while (temp_dim >= 1.0) { LLVector3 pos_region_scaled(pos_region * temp_dim); r_val += getVelocity(pos_region_scaled) * (1.0f/temp_dim); temp_dim /= 2.0; } return r_val * (1.0f/norm) * WIND_SCALE_HACK; }
LLVector3 LLWind::getVelocityNoisy(const LLVector3 &pos_region, const F32 dim) { // Resolve a value, using fractal summing to perturb the returned value LLVector3 r_val(0,0,0); F32 norm = 1.0f; if (dim == 8) { norm = 1.875; } else if (dim == 4) { norm = 1.75; } else if (dim == 2) { norm = 1.5; } F32 temp_dim = dim; while (temp_dim >= 1.0) { LLVector3 pos_region_scaled(pos_region * temp_dim); r_val += getVelocity(pos_region_scaled) * (1.0f/temp_dim); temp_dim /= 2.0; } return r_val * (1.0f/norm) * WIND_SCALE_HACK; }
static inline double source_budget(size_t g, errors_type &errors, double overshoot) { double nom, denom, r = r_val(g, errors); nom = g + r - r*errors[e2]; denom = 2 - errors[e3] - errors[e2]; return overshoot*nom/denom; }
static inline double helper_budget(size_t g, errors_type &errors) { double nom, denom, r = r_val(g, errors); nom = errors[e3]*r - r + g; denom = 2 - errors[e2] - errors[e3]; return nom/denom; }
static inline double helper_threshold(size_t g, errors_type &errors) { double r = r_val(g, errors); return r - r*errors[e1]; }