Skip to content

Commit 372ce07

Browse files
committed
Add symAxis vector to RB drawing
1 parent ec24dbc commit 372ce07

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

GSASII/GSASIIconstrGUI.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,6 +3239,7 @@ def OnSymRadioSet(event):
32393239
Obj = event.GetEventObject()
32403240
axis = ([1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,1,1])[Obj.GetSelection()]
32413241
rbData['symAxis'] = axis
3242+
G2plt.PlotRigidBody(G2frame,'Vector',AtInfo,data['Vector'][rbid],plotDefaults)
32423243

32433244
refAtmSizer = wx.BoxSizer(wx.HORIZONTAL)
32443245
choices = [' x ',' y ',' z ','x+y','x+y+z']

GSASII/GSASIIplot.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
npasind = lambda x: 180.*np.arcsin(x)/np.pi
9696
npatand = lambda x: 180.*np.arctan(x)/np.pi
9797
npatan2d = lambda x,y: 180.*np.arctan2(x,y)/np.pi
98+
vnorm = lambda v: v/nl.norm(v)
9899
try: # fails on doc build
99100
sq8ln2 = np.sqrt(8.0*np.log(2.0))
100101
except 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

Comments
 (0)