예제 #1
0
파일: view.c 프로젝트: jpeak5/csc4356
void view_turn(view *V, const double *w)
{
#if 0
    double M[16], T[16], q[4], a[3], b[3], c[3], t[3];

    assert(V);

    /* Transform the mark and drag vectors from eye space into the world     */
    /* space current at the time of the mark.                                */

    state_matrix(M, &V->mark);

    mtranspose(T, M);
    vnormalize(t, V->a);
    vtransform(a, T, t);
    vnormalize(t,    w);
    vtransform(b, T, t);

    /* These determine the axis and angle of rotation.  Find the quaternion. */

    vcrs(t, a, b);
    vnormalize(c, t);
    qrotate(q, c, acos(vdot(a, b)));

    /* Accumulate this quaternion with the view state, rotating the view.    */

    qmultiply(view_curr(V)->q, V->mark.q, q);
#endif
}
예제 #2
0
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);
}