9595npasind = lambda x : 180. * np .arcsin (x )/ np .pi
9696npatand = lambda x : 180. * np .arctan (x )/ np .pi
9797npatan2d = lambda x ,y : 180. * np .arctan2 (x ,y )/ np .pi
98+ vnorm = lambda v : v / nl .norm (v )
9899try : # fails on doc build
99100 sq8ln2 = np .sqrt (8.0 * np .log (2.0 ))
100101except TypeError :
@@ -8202,7 +8203,7 @@ def SetRotationZ(newxy):
82028203 Q = G2mth .prodQQ (Q ,Qy )
82038204 defaults ['Quaternion' ] = Q
82048205
8205- def RenderUnitVectors (x ,y ,z ):
8206+ def RenderUnitVectors (x ,y ,z , symAxis ):
82068207 GL .glEnable (GL .GL_COLOR_MATERIAL )
82078208 GL .glLineWidth (1 )
82088209 GL .glPushMatrix ()
@@ -8212,6 +8213,11 @@ def RenderUnitVectors(x,y,z):
82128213 GL .glColor3ubv (color )
82138214 GL .glVertex3fv (- line [1 ])
82148215 GL .glVertex3fv (line [1 ])
8216+ if symAxis :
8217+ Vfrac = vnorm (np .array (symAxis ))
8218+ GL .glColor3ubv ([255 ,255 ,255 ])
8219+ GL .glVertex3fv (np .zeros (3 ))
8220+ GL .glVertex3fv (1.5 * Vfrac )
82158221 GL .glEnd ()
82168222 GL .glPopMatrix ()
82178223 GL .glColor4ubv ([0 ,0 ,0 ,0 ])
@@ -8283,7 +8289,7 @@ def Draw(caller=''):
82838289 matRot = G2mth .Q2Mat (Q )
82848290 matRot = np .concatenate ((np .concatenate ((matRot ,[[0 ],[0 ],[0 ]]),axis = 1 ),[[0 ,0 ,0 ,1 ],]),axis = 0 )
82858291 GL .glMultMatrixf (matRot .T )
8286- RenderUnitVectors (0. ,0. ,0. )
8292+ RenderUnitVectors (0. ,0. ,0. , symAxis )
82878293 radius = 0.2
82888294 s = 1
82898295 selected = rbData .get ('Selection' )
@@ -8363,6 +8369,7 @@ def UpdateDraw():
83638369 uBox = np .array ([[0 ,0 ,0 ],[1 ,0 ,0 ],[0 ,1 ,0 ],[0 ,0 ,1 ]])
83648370 uEdges = np .array ([[uBox [0 ],uBox [1 ]],[uBox [0 ],uBox [2 ]],[uBox [0 ],uBox [3 ]]])
83658371 uColors = [Rd ,Gr ,Bl ]
8372+ symAxis = rbData .get ('symAxis' ,[0 ,0 ,1 ])
83668373 if rbType == 'Vector' :
83678374 atNames = [str (i )+ ':' + Ty for i ,Ty in enumerate (rbData ['rbTypes' ])]
83688375 XYZ = np .array ([[0. ,0. ,0. ] for Ty in rbData ['rbTypes' ]])
0 commit comments