Changeset 755 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Sep 8, 2012 10:14:53 AM (10 years ago)
Author:
vondreele
Message:

fix rotation about view direction
eliminate divide by zero error in quaternion stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r754 r755  
    26722672#first get rotation vector (= view vector) in screen coords. & angle increment       
    26732673        View = glGetIntegerv(GL_VIEWPORT)
     2674        cent = [View[2]/2,View[3]/2]
    26742675        oldxy = drawingData['oldxy']
    26752676        if not len(oldxy): oldxy = list(newxy)
     
    26772678        drawingData['oldxy'] = list(newxy)
    26782679        V = drawingData['viewDir']
    2679         X0 = drawingData['viewPoint'][0]
    2680         A = (dxy[0]+dxy[1])*.25
    2681 # next transform vector back to xtal coordinates via inverse quaternion
    2682 # & make new quaternion
     2680        A = [0,0]
     2681        A[0] = dxy[1]*.25
     2682        A[1] = dxy[0]*.25
     2683        if newxy[0] > cent[0]:
     2684            A[0] *= -1
     2685        if newxy[1] < cent[1]:
     2686            A[1] *= -1       
     2687# next transform vector back to xtal coordinates & make new quaternion
    26832688        Q = drawingData['Quaternion']
    26842689        V = np.inner(Amat,V)
    2685         DQ = G2mth.AVdeg2Q(A,V)
    2686         Q = G2mth.prodQQ(Q,DQ)
     2690        Qx = G2mth.AVdeg2Q(A[0],V)
     2691        Qy = G2mth.AVdeg2Q(A[1],V)
     2692        Q = G2mth.prodQQ(Q,Qx)
     2693        Q = G2mth.prodQQ(Q,Qy)
    26872694        drawingData['Quaternion'] = Q
    26882695
Note: See TracChangeset for help on using the changeset viewer.