void view_step(view *V, double dt) { double I[16], v[3]; assert(V); /* Compute the world-space velocity vector. */ state_inverse(I, view_curr(V)); vtransform(v, I, V->v); /* Integrate the new position along this vector. */ vmad(view_curr(V)->p, view_curr(V)->p, v, dt); }
void sph_model::zoom(double *w, const double *v) { double d = vdot(v, zoomv); if (-1 < d && d < 1) { double b = scale(zoomk, acos(d) / M_PI) * M_PI; double y[3]; double x[3]; vcrs(y, v, zoomv); vnormalize(y, y); vcrs(x, zoomv, y); vnormalize(x, x); vmul(w, zoomv, cos(b)); vmad(w, w, x, sin(b)); } else vcpy(w, v); }