void prep_et() { /* Set ups the spline to sample et. */ double et; double gn0 = -1, gt0; slLimit = 6*mu - mu*kn/kt; double *x = (double*)calloc(100, sizeof(double)); double *y = (double*)calloc(100, sizeof(double)); /* Write first point. */ x[0] = 0; y[0] = cos(sqrt(3*kt/meff)*t_col()); /* Calculate intermediate points. */ long i; for (i = 1; i < 100; i++) { gt0 = slLimit/100.0*i; double ratio = fabs(gt0/(double)gn0); et = calculate_et(gn0, gt0); x[i] = ratio; y[i] = et; } /* Write last point. */ x[100] = 6*mu - mu*kn/kt; y[100] = 1 - 3*mu*(1 + calc_en())/x[100]; /* Interpolation with cubic spline. */ acc = gsl_interp_accel_alloc(); spline = gsl_spline_alloc(gsl_interp_cspline, 101); gsl_spline_init(spline, x, y, 101); }
void Panel_Platform::UpdateBG_colours( ob_object* platform_prop ) { wxColour t_col( *wxWHITE ); if( platform_prop->parent != NULL && ((ob_frame*) platform_prop->parent)->b_platform_cloned == true ) t_col = cloneColour; txtctrl_off_x->SetBackgroundColour( t_col ); txtctrl_off_y->SetBackgroundColour( t_col ); txtctrl_up_l->SetBackgroundColour( t_col ); txtctrl_d_l->SetBackgroundColour( t_col ); txtctrl_up_r->SetBackgroundColour( t_col ); txtctrl_l_r->SetBackgroundColour( t_col ); txtctrl_depth->SetBackgroundColour( t_col ); txtctrl_alt->SetBackgroundColour( t_col ); }
double calculate_et(double gn00, double gt00) { double gt = 0, tSpr, ts = 0; assert(gn00 < 0); assert(gt00 != 0); gn0 = gn00; gt0 = gt00; t0 = 0; tSpr0 = 0; tc = t_col(); if (gammav == 0 && fabs(gt0/(double)gn0) > mu*kn/kt) { ts = calc_ts(1); gt = tang_vel_sl(ts); tSpr = tang_spring_sl(normal_force(ts)); t0 = ts; gt0 = gt; tSpr0 = tSpr; } int sticking = 1; while (ts < tc) { if (sticking) { ts = calc_ts(0); gt = tang_vel_st(ts); tSpr = tang_spring_st(ts); sticking = 0; } else { ts = calc_ts(1); gt = tang_vel_sl(ts); tSpr = tang_spring_sl(normal_force(ts)); sticking = 1; } t0 = ts; gt0 = gt; tSpr0 = tSpr; } return gt/(double)gt00; }