|
From: Jared S. <jar...@co...> - 2022-03-25 18:20:40
|
Hi Wei -
Fun problem! Not a "smart" way to do it, but I think functional, using
pseudoatoms and orient to set the view angle:
```
# Create an origin pseudoatom
ori_coords = [0.4017522, 23.15367207, 6.68992345]
cmd.pseudoatom("ori", pos=ori_coords)
color red, ori
show nb_spheres, ori
# Second pseudoatom as a stand-in for the camera
axis = [0.74, 0.18, -0.65]
cam_coords = [sum(x) for x in zip(ori_coords, axis)]
cmd.pseudoatom("cam", pos=cam_coords)
# Adjust the view so the sphere is centered and crosshairs are aligned on
camera Z axis
orient
center ori
turn y, -90
# Print the current view matrix
get_view
```
yields
```
set_view (\
-0.673201025, 0.023786053, 0.739076912,\
0.231151611, 0.956164062, 0.179775774,\
-0.702402592, 0.291863978, -0.649188757,\
0.000000000, 0.000000000, -14.178204536,\
0.401752204, 23.153671265, 6.689923286,\
11.178205490, 17.178203583, -20.000000000 )
```
[image: image.png]
Hope that helps.
Cheers,
Jared
On Fri, Mar 25, 2022 at 12:44 PM Wei Wang <ww...@co...> wrote:
> Dear PyMOL community,
>
> I have a need to adjust my view point in python script. I want to achieve
> the following:
>
> 1. I have a origin with coordinates [ 0.4017522 23.15367207 6.68992345]
> 2. I have a vector/rotation axis [0.74, 0.18, -0.65]
> 3. I want to look directly down that vector using above origin.
>
> Theoretically I should be able to use those information to determine the
> values needed to put in set_view. However, I’m not smart enough to do that.
> Would anyone please show me the way?
>
> Many thanks,
>
> Wei
> _______________________________________________
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pym...@li...
> Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
|