@@ -6470,7 +6470,7 @@ def SetRBText():
64706470 page = getSelection ()
64716471 if page :
64726472 if G2frame .phaseDisplay .GetPageText (page ) == 'RB Models' :
6473- G2phG .updateAddRBorientText (G2frame ,testRBObj ,Bmat )
6473+ G2phG .updateAddRBorientText (G2frame ,testRBObj ,Bmat , ifSlide = False )
64746474 if pageCallback :
64756475 try :
64766476 pageCallback ()
@@ -6659,6 +6659,27 @@ def SetRotation(newxy):
66596659 drawingData ['viewDir' ] = VD
66606660 SetViewDirText (VD )
66616661
6662+ def SetRBRotation (newxy ):
6663+ #first get rotation vector in screen coords. & angle increment
6664+ oldxy = drawingData ['oldxy' ]
6665+ if not len (oldxy ): oldxy = list (newxy )
6666+ dxy = newxy - oldxy
6667+ if dxy [0 ] == dxy [1 ] == 0 : return
6668+ drawingData ['oldxy' ] = list (newxy )
6669+ V = np .array ([dxy [1 ],dxy [0 ],0. ])
6670+ A = 0.1 * np .sqrt (dxy [0 ]** 2 + dxy [1 ]** 2 )
6671+ if not A : return # nothing changed, nothing to do
6672+ # next transform vector back to xtal coordinates via inverse quaternion
6673+ # & make new quaternion
6674+ Q = rbObj ['Orient' ][0 ] #rotate RB to Cart
6675+ QC = drawingData ['Quaternion' ] #rotate Cart to drawing
6676+ V = G2mth .prodQVQ (G2mth .invQ (QC ),V )
6677+ V = G2mth .prodQVQ (G2mth .invQ (Q ),V )
6678+ DQ = G2mth .AVdeg2Q (A ,V )
6679+ Q = G2mth .prodQQ (Q ,DQ )
6680+ rbObj ['Orient' ][0 ][:] = Q
6681+ SetRBText ()
6682+
66626683 def SetRotationZ (newxy ):
66636684#first get rotation vector (= view vector) in screen coords. & angle increment
66646685 View = GL .glGetIntegerv (GL .GL_VIEWPORT )
@@ -6685,26 +6706,6 @@ def SetRotationZ(newxy):
66856706 Q = G2mth .prodQQ (Q ,Qy )
66866707 drawingData ['Quaternion' ] = Q
66876708
6688- def SetRBRotation (newxy ):
6689- #first get rotation vector in screen coords. & angle increment
6690- oldxy = drawingData ['oldxy' ]
6691- if not len (oldxy ): oldxy = list (newxy )
6692- dxy = newxy - oldxy
6693- if dxy [0 ] == dxy [1 ] == 0 : return
6694- drawingData ['oldxy' ] = list (newxy )
6695- V = np .array ([dxy [1 ],dxy [0 ],0. ])
6696- A = 0.25 * np .sqrt (dxy [0 ]** 2 + dxy [1 ]** 2 )
6697- # next transform vector back to xtal coordinates via inverse quaternion
6698- # & make new quaternion
6699- Q = rbObj ['Orient' ][0 ] #rotate RB to Cart
6700- QC = drawingData ['Quaternion' ] #rotate Cart to drawing
6701- V = G2mth .prodQVQ (G2mth .invQ (QC ),V )
6702- V = G2mth .prodQVQ (G2mth .invQ (Q ),V )
6703- DQ = G2mth .AVdeg2Q (A ,V )
6704- Q = G2mth .prodQQ (Q ,DQ )
6705- rbObj ['Orient' ][0 ][:] = Q
6706- SetRBText ()
6707-
67086709 def SetRBRotationZ (newxy ):
67096710#first get rotation vector (= view vector) in screen coords. & angle increment
67106711 View = GL .glGetIntegerv (GL .GL_VIEWPORT )
@@ -6716,8 +6717,8 @@ def SetRBRotationZ(newxy):
67166717 drawingData ['oldxy' ] = list (newxy )
67176718 V = drawingData ['viewDir' ]
67186719 A = [0 ,0 ]
6719- A [0 ] = dxy [1 ]* .25
6720- A [1 ] = dxy [0 ]* .25
6720+ A [0 ] = dxy [1 ]* .1
6721+ A [1 ] = dxy [0 ]* .1
67216722 if newxy [0 ] < cent [0 ]:
67226723 A [0 ] *= - 1
67236724 if newxy [1 ] > cent [1 ]:
0 commit comments