Changeset 3931
 Timestamp:
 Apr 24, 2019 3:41:44 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIphsGUI.py
r3928 r3931 6285 6285 try: 6286 6286 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 6287 #reset view to stndard 6288 drawingData['viewDir'] = [0,0,1] 6289 drawingData['oldxy'] = [] 6290 V0 = np.array([0,0,1]) 6291 V = np.inner(Amat,V0) 6292 V /= np.sqrt(np.sum(V**2)) 6293 A = np.arccos(np.sum(V*V0)) 6294 Q = G2mth.AV2Q(A,[0,1,0]) 6295 drawingData['Quaternion'] = Q 6296 #new view made here 6287 6297 VD = np.array([float(viewDir[i]) for i in range(3)]) 6288 6298 VC = np.inner(Amat,VD) … … 6293 6303 VX = np.cross(VC,VB) 6294 6304 A = acosd(max((2.np.sum((VBVC)**2))/2.,1.)) 6305 if A == 0.0 and len(viewDir) == 3: 6306 raise ValueError #avoid a no op 6307 # print('\nnew view =',viewDir) 6308 # print('A=%.3f, V='%A,VX) 6295 6309 QV = G2mth.AVdeg2Q(A,VX) 6296 6310 if len(viewDir) > 3: … … 6301 6315 VY0 = np.array([0.,1.,0.]) 6302 6316 if 'H' == viewDir[3].upper(): 6303 QV = G2mth.prodQQ( QV,np.array([0.,rt2,0.,rt2]))6317 QV = G2mth.prodQQ(np.array([rt2,0.,rt2,0.]),QV) #rotate 90deg about +ve Y 6304 6318 VD = np.inner(invModel.T,VX0) 6305 6319 elif 'V' == viewDir[3].upper(): 6306 QV = G2mth.prodQQ( QV,np.array([rt2,0.,0.,rt2]))6320 QV = G2mth.prodQQ(np.array([rt2,rt2,0.,0.]),QV) #rotate 90deg about ve X 6307 6321 VD = np.inner(invModel.T,VY0) 6322 # NAV = G2mth.Q2AVdeg(QV) 6323 # print('dir = %s, A= %.3f, V = '%(viewDir[3],NAV[0]),NAV[1:]) 6308 6324 VD /= np.sqrt(np.sum(VD**2)) 6325 # print('new view dir = ',VD) 6309 6326 Q = drawingData['Quaternion'] 6310 drawingData['Quaternion'] = G2mth.prodQQ(QV,Q) 6327 QN = G2mth.prodQQ(Q,QV) 6328 drawingData['Quaternion'] = QN 6311 6329 except (ValueError,IndexError): 6312 6330 VD = drawingData['viewDir'] … … 6327 6345 style=wx.TE_PROCESS_ENTER,size=wx.Size(140,20),name='viewDir') 6328 6346 viewDir.Bind(wx.EVT_TEXT_ENTER,OnViewDir) 6329 viewDir.Bind(wx.EVT_KILL_FOCUS,OnViewDir)6347 # viewDir.Bind(wx.EVT_KILL_FOCUS,OnViewDir) 6330 6348 G2frame.phaseDisplay.viewDir = viewDir 6331 6349 lineSizer.Add(viewDir,0,WACV)
Note: See TracChangeset
for help on using the changeset viewer.