void MoveSpline::Initialize(MoveSplineInitArgs const& args) { splineflags = args.flags; facing = args.facing; m_Id = args.splineId; point_Idx_offset = args.path_Idx_offset; initialOrientation = args.initialOrientation; time_passed = 0; vertical_acceleration = 0.f; effect_start_time = 0; splineIsFacingOnly = args.path.size() == 2 && args.facing.type != MONSTER_MOVE_NORMAL && ((args.path[1] - args.path[0]).length() < 0.1f); // Check if its a stop spline if (args.flags.done) { spline.clear(); return; } init_spline(args); // init parabolic / animation // spline initialized, duration known and i able to compute parabolic acceleration if (args.flags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation | MoveSplineFlag::Unknown6)) { effect_start_time = Duration() * args.time_perc; if (args.flags.parabolic && effect_start_time < Duration()) { float f_duration = MSToSec(Duration() - effect_start_time); vertical_acceleration = args.parabolic_amplitude * 8.f / (f_duration * f_duration); } } }
void MoveSpline::Initialize(const MoveSplineInitArgs& args) { splineflags = args.flags; facing = args.facing; m_Id = args.splineId; point_Idx_offset = args.path_Idx_offset; initialOrientation = args.initialOrientation; time_passed = 0; vertical_acceleration = 0.f; effect_start_time = 0; init_spline(args); // init parabolic / animation // spline initialized, duration known and i able to compute parabolic acceleration if (args.flags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation)) { effect_start_time = Duration() * args.time_perc; if (args.flags.parabolic && effect_start_time < Duration()) { float f_duration = MSToSec(Duration() - effect_start_time); vertical_acceleration = args.parabolic_amplitude * 8.f / (f_duration * f_duration); } } }
VHXC::VHXC(ParticleSet& ptcl) : PtclRef(&ptcl), FirstTime(true) { VSpline[0] = 0; VSpline[1] = 0; init_spline(); }
void MPC::initBreakup() { NParticles = PtclRef->getTotalNum(); app_log() << "\n === Initializing MPC interaction === " << endl; if (PtclRef->Density_G.size() == 0) { app_error() << "************************\n" << "** Error in MPC setup **\n" << "************************\n" << " The electron density was not setup by the " << "wave function builder.\n"; abort(); } init_gvecs(); init_f_G(); init_spline(); // FILE *fout = fopen ("MPC.dat", "w"); // double vol = PtclRef->Lattice.Volume; // PosType r0 (0.0, 0.0, 0.0); // PosType r1 (10.26499236, 10.26499236, 10.26499236); // int nPoints=1001; // for (int i=0; i<nPoints; i++) { // double s = (double)i/(double)(nPoints-1); // PosType r = (1.0-s)*r0 + s*r1; // PosType u = PtclRef->Lattice.toUnit(r); // double V, rho(0.0); // eval_UBspline_3d_d (VlongSpline, u[0], u[1], u[2], &V); // // eval_UBspline_3d_d (DensitySpline, u[0], u[1], u[2], &rho); // fprintf (fout, "%6.4f %14.10e %14.10e\n", s, V, rho); // } // fclose(fout); app_log() << " === MPC interaction initialized === \n\n"; }
void mpg123_set_eq(int on, float preamp, float *b) { float x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, yf[10], val, band[10]; int bands[] = {0, 4, 8, 16, 26, 78, 157, 313, 366, 418}; int i, j; mpg123_info->eq_active = on; if (mpg123_info->eq_active) { for (i = 0; i < 10; i++) { band[i] = b[i] + preamp; } init_spline(x, band, 10, yf); for (i = 0; i < 9; i++) { for (j = bands[i]; j < bands[i + 1]; j++) { val = eval_spline(x, band, yf, 10, i + ((float) (j - bands[i]) * (1.0 / (bands[i + 1] - bands[i])))); mpg123_info->eq_mul[j] = pow(2, val / 10.0); } } for (i = bands[9]; i < 576; i++) mpg123_info->eq_mul[i] = mpg123_info->eq_mul[bands[9] - 1]; } }
void MoveSpline::Initialize(const MoveSplineInitArgs& args) { splineflags = args.flags; facing = args.facing; m_Id = args.splineId; point_Idx_offset = args.path_Idx_offset; time_passed = 0; init_spline(args); }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { struct GRD_HEADER grd; double p = 0.0, *z, *x, *y, *xm, *idx, *c, par[10], xmin, i_xinc; char *argv = "WB_lookup"; int error, nx, ny, n, i; if (nrhs != 5 || nlhs < 1) { mexPrintf ("usage: z = WB_lookup(x,p,y,xmin,idx);\n"); return; } nx = mxGetN (prhs[1]); ny = mxGetM (prhs[1]); if (nx > 1 || ny > 1) { mexPrintf ("WB_lookup: p must be a constant\n"); return; } y = mxGetPr (prhs[1]); p = y[0]; xm = mxGetPr (prhs[3]); xmin = xm[0]; idx = mxGetPr (prhs[4]); i_xinc = idx[0]; init_spline (p, par); c = mxGetPr (prhs[2]); x = mxGetPr (prhs[0]); nx = mxGetN (prhs[0]); ny = mxGetM (prhs[0]); n = nx * ny; /* Create a matrix for the return array */ plhs[0] = mxCreateDoubleMatrix (ny, nx, mxREAL); z = mxGetPr (plhs[0]); for (i = 0; i < n; i++) z[i] = WB_lookup (x[i], par, c, xmin, i_xinc); return; }