Thought::Thought(int id, QSettings &s, QObject *parent) : QObject(parent) , m_title(s.value("title", "Unknown").toString()) , m_description(s.value("thought", m_title).toString()) , m_effect(s.value("value", 0).toInt()) , m_subtype(s.value("subthoughts_type",-1).toInt()) , m_id(id) { if(m_effect == 0){ m_color = c_neu(); } else if(m_effect > 0){ m_color = c_pos(); }else{ m_color = c_neg(); } //-1000 to +1000 //(x - from_min) * (to_max - to_min) / (from_max - from_min) + to_min int alpha = (((m_effect + 50) * (255-75)) / 100) + 75; if(alpha > 255) alpha = 255; else if(alpha < 0) alpha = 0; if(m_effect < 0) alpha = 255 - alpha; m_color.setAlpha(alpha); }
/** * \brief Expand pole product * \param c resulting filter coefficients * \param poles pole locations * \param K number of poles * \ingroup vyv_gaussian * * This routine expands the product to obtain the filter coefficients: * \f[ \prod_{k=0}^{K-1}\frac{\mathrm{poles}[k]-1}{\mathrm{poles}[k]-z^{-1}} = \frac{c[0]}{1+\sum_{k=1}^K c[k] z^{-k}}. \f] */ static void expand_pole_product(double *c, const complex4c *poles, int K) { complex4c denom[VYV_MAX_K + 1]; int k, j; assert(K <= VYV_MAX_K); denom[0] = poles[0]; denom[1] = make_complex(-1, 0); for (k = 1; k < K; ++k) { denom[k + 1] = c_neg(denom[k]); for (j = k; j > 0; --j) denom[j] = c_sub(c_mul(denom[j], poles[k]), denom[j - 1]); denom[0] = c_mul(denom[0], poles[k]); } for (k = 1; k <= K; ++k) c[k] = c_div(denom[k], denom[0]).real; for (c[0] = 1, k = 1; k <= K; ++k) c[0] += c[k]; return; }
static Py_complex c_asin(Py_complex x) { /* -i * log[(sqrt(1-x**2) + i*x] */ const Py_complex squared = c_prod(x, x); const Py_complex sqrt_1_minus_x_sq = c_sqrt(c_diff(c_one, squared)); return c_neg(c_prodi(c_log( c_sum(sqrt_1_minus_x_sq, c_prodi(x)) ) ) ); }
static Py_complex c_acos(Py_complex x) { return c_neg(c_prodi(c_log(c_sum(x,c_prod(c_i, c_sqrt(c_diff(c_one,c_prod(x,x)))))))); }