[PyMOL] Question on rotation

 [PyMOL] Question on rotation From: Terry Jones - 2006-04-25 20:47:36 ```I wrote a pymol plugin that produces a bunch of cgo. The images I generate have a cube drawn around them. I've been asked if it's possible to allow the user to initially rotate the image to their heart's content and then have the plugin draw the surrounding cube. I.e., once the image is rotated, the cube will be drawn in a way that always looks good to the viewer, not at some random angle. In other words, the cube will always have the same orientation, no matter how much the image has been rotated before the cube is drawn. OK, having said the same thing 3 times, and hopefully made sense at least once, I'll say something new... I imagine this can be done easily enough. I guess I should be able to call get_view and get the current rotation matrix (elements 0-8 of the returned list) and apply this to all points that I plan to draw between when making the cube. My questions: Is this right? Do I need to do anything more than just multiply the old point by the rotation matrix? What's the easiest way to do this in Pymol or Python, or should I just code it (it's very simple after all). And, of course, is there a better way to do what I want? Thanks for any help. Don't assume I know what I'm doing, because I probably don't. So the more details, the better. Regards, Terry ```

 [PyMOL] Question on rotation From: Terry Jones - 2006-04-25 20:47:36 ```I wrote a pymol plugin that produces a bunch of cgo. The images I generate have a cube drawn around them. I've been asked if it's possible to allow the user to initially rotate the image to their heart's content and then have the plugin draw the surrounding cube. I.e., once the image is rotated, the cube will be drawn in a way that always looks good to the viewer, not at some random angle. In other words, the cube will always have the same orientation, no matter how much the image has been rotated before the cube is drawn. OK, having said the same thing 3 times, and hopefully made sense at least once, I'll say something new... I imagine this can be done easily enough. I guess I should be able to call get_view and get the current rotation matrix (elements 0-8 of the returned list) and apply this to all points that I plan to draw between when making the cube. My questions: Is this right? Do I need to do anything more than just multiply the old point by the rotation matrix? What's the easiest way to do this in Pymol or Python, or should I just code it (it's very simple after all). And, of course, is there a better way to do what I want? Thanks for any help. Don't assume I know what I'm doing, because I probably don't. So the more details, the better. Regards, Terry ```
 Re: [PyMOL] Question on rotation From: Tsjerk Wassenaar - 2006-04-26 07:58:58 Attachments: Message as HTML ```Hi Terry, There's a bit more to it. In the pymol view, the camera is located at the origin, so to rotate your coordinates you first have to move the center to the origin, do the rotation and move the thing back. I've scripted this in Povray. If you're interested, I can send you the script. You can then rescript it in python or you can output your scene to povray and do the res= t there. In addition (although you may already know this), the meaning of all elements of the result of get_view (python index) is 0:9 - rotation matrix 9:12 - camera position 12:15 - origin of rotation 15:17 - slab near and far 17 - orthoscopic flag Cheers, Tsjerk On 4/25/06, Terry Jones wrote: > > I wrote a pymol plugin that produces a bunch of cgo. The images I generat= e > have a cube drawn around them. > > I've been asked if it's possible to allow the user to initially rotate th= e > image to their heart's content and then have the plugin draw the > surrounding cube. I.e., once the image is rotated, the cube will be drawn > in a way that always looks good to the viewer, not at some random angle. > In > other words, the cube will always have the same orientation, no matter ho= w > much the image has been rotated before the cube is drawn. > > OK, having said the same thing 3 times, and hopefully made sense at least > once, I'll say something new... > > I imagine this can be done easily enough. I guess I should be able to cal= l > get_view and get the current rotation matrix (elements 0-8 of the returne= d > list) and apply this to all points that I plan to draw between when makin= g > the cube. > > My questions: Is this right? Do I need to do anything more than just > multiply the old point by the rotation matrix? What's the easiest way to > do > this in Pymol or Python, or should I just code it (it's very simple after > all). And, of course, is there a better way to do what I want? > > Thanks for any help. Don't assume I know what I'm doing, because I > probably > don't. So the more details, the better. > > Regards, > Terry > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@... > https://lists.sourceforge.net/lists/listinfo/pymol-users > -- Tsjerk A. Wassenaar, M.Sc. Groningen Biomolecular Sciences and Biotechnology Institute (GBB) Dept. of Biophysical Chemistry University of Groningen Nijenborgh 4 9747AG Groningen, The Netherlands +31 50 363 4336 ```
 Re: [PyMOL] Question on rotation From: Terry Jones - 2006-04-26 08:40:46 ```Hi Tsjerk >>>>> "Tsjerk" == Tsjerk Wassenaar writes: Tsjerk> There's a bit more to it. In the pymol view, the camera is located Tsjerk> at the origin, so to rotate your coordinates you first have to move Tsjerk> the center to the origin, do the rotation and move the thing Tsjerk> back. I've scripted this in Povray. If you're interested, I can Tsjerk> send you the script. Yes, that sounds great, thanks. Tsjerk> You can then rescript it in python or you can Tsjerk> output your scene to povray and do the rest there. If it's not too complex, I'll rewrite for python so I can run it interactively. Tsjerk> In addition (although you may already know this), the meaning of Tsjerk> all elements of the result of get_view (python index) is Yes, thanks a lot. Terry ```