Changeset 1966 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Aug 28, 2015 3:02:12 PM (8 years ago)
Author:
vondreele
Message:

new 3D HKL plot commands for selecting view axes & set a zone plot - trouble with rotations tho.
SS structure factor by integration, not Bessel fxns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r1958 r1966  
    572572        global ifBox
    573573        Choice = {'F':'Fo','S':'Fosq','U':'Unit','D':'dFsq','W':'dFsq/sig'}
     574        viewChoice = {'H':[[1,0,0],[0,0,1]],'K':[[0,1,0],[1,0,0]],'L':[[0,0,1],[0,1,0]]}
    574575        try:
    575576            keyCode = event.GetKeyCode()
     
    579580        except AttributeError:       #if from OnKeyBox above
    580581            key = str(event.key).upper()
    581         if key in ['C']:
     582        if key in ['C','H','K','L']:
     583            if key == 'C':
     584                Data['Zone'] = False
     585                key = 'L'
    582586            drawingData['viewPoint'][0] = drawingData['default']
    583             drawingData['viewDir'] = [0,0,1]
     587            drawingData['viewDir'] = viewChoice[key][0]
     588            drawingData['viewUp'] = viewChoice[key][1]
    584589            drawingData['oldxy'] = []
    585             V0 = np.array([0,0,1])
    586             V = np.inner(Amat,V0)
    587             V /= np.sqrt(np.sum(V**2))
    588             A = np.arccos(np.sum(V*V0))
    589             Q = G2mth.AV2Q(A,[0,1,0])
    590             drawingData['Quaternion'] = Q
    591             Q = drawingData['Quaternion']
     590#            V0 = np.array(viewChoice[key][0])
     591#            V = np.inner(Amat,V0)
     592#            V /= np.sqrt(np.sum(V**2))
     593#            A = np.arccos(np.sum(V*V0))
     594#            Q = G2mth.AV2Q(A,viewChoice[key][1])
     595            drawingData['Quaternion'] = [-1,0,0,0]  #the old stuff always gave this...
     596        elif key in 'Z':
     597            Data['Zone'] = not Data['Zone']
    592598        elif key in 'B':
    593599            ifBox = not ifBox
     
    883889        cPos = drawingData['cameraPos']
    884890        Zclip = drawingData['Zclip']*cPos/20.
     891        if Data['Zone']:
     892            Zclip = 0.1
    885893        Q = drawingData['Quaternion']
    886894        Tx,Ty,Tz = drawingData['viewPoint'][0]
     
    901909        glViewport(0,0,VS[0],VS[1])
    902910        gluPerspective(20.,aspect,cPos-Zclip,cPos+Zclip)
    903         gluLookAt(0,0,cPos,0,0,0,0,1,0)
     911        vDir = drawingData['viewDir']
     912        vUp = drawingData['viewUp']
     913#        gluLookAt(0,0,cPos,0,0,0,0,1,0)
     914        gluLookAt(vDir[0]*cPos,vDir[1]*cPos,vDir[2]*cPos, 0,0,0, vUp[0],vUp[1],vUp[2])
    904915        SetLights()           
    905916           
     
    936947    Page.SetFocus()
    937948    Page.Choice = None
    938     choice = [' save as/key:','jpeg','tiff','bmp','c: recenter to default','b: toggle box ','+: increase scale',
    939     '-: decrease scale','f: Fobs','s: Fobs**2','u: unit','d: Fo-Fc','w: DF/sig','i: toggle intensity scaling']
     949    choice = [' save as/key:','jpeg','tiff','bmp','h: view down h','k: view down k','l: view down l',
     950    'z: zero zone toggle','c: reset to default','b: toggle box ','+: increase scale','-: decrease scale',
     951    'f: Fobs','s: Fobs**2','u: unit','d: Fo-Fc','w: DF/sig','i: toggle intensity scaling']
    940952    cb = wx.ComboBox(G2frame.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,choices=choice)
    941953    cb.Bind(wx.EVT_COMBOBOX, OnKeyBox)
Note: See TracChangeset for help on using the changeset viewer.