# Re: [PyMOL] Yaw, Pitch and Roll of CGO

```Jared, Thomas thank you guys!

Now everything works great :)
The solution was pretty simple and I don't know why it took me so long...
I have a X,Y and Z coordinates from my SensAble Pantom haptic device and
quaternions to do rotations of cone.```
```
The problem was, that in 'translate' function I didn't use 'camera=0'
option, what in did in 'rotate'. Moreover I should set 'origin=[X,Y,Z]'
option as well as 'camera=0' in rotate option.

Now it work smoothly and pretty nice ;)

Thank you
Paweł

2014-02-18 19:40 GMT+01:00 Sampson, Jared <jared.samp...@nyumc.org>:

>  Hi Pawel -
>
>  If you can determine the primary axis of the cone from the tip and the
> center of the circle at the base, you can give `rotate` an arbitrary
> [x,y,z] float vector as its first argument instead of x, y or z.  For
> example, if you generate your cone using something like the following
> Python script:
>
>  ### cone_cgo.py ###
>
>   from pymol.cgo import *
> from pymol import cmd
>
>  # set up the cone
> base_xyz = [1.0, 2.0, 3.0]
> tip_xyz = [4.0, 5.0, 6.0]
> base_radius = 1.0
> tip_radius = 0.0
> base_color = [0.9, 0.0, 0.0]
> tip_color = [0.0, 0.0, 0.9]
>
>  # calculate the cone axis
> cone_axis = [ tip_xyz[0]-base_xyz[0],
>               tip_xyz[1]-base_xyz[1],
>               tip_xyz[2]-base_xyz[2] ]
>
>  # print the axis to use later
> print cone_axis
>
>  # generate the cone CGO text
> obj = [CONE, base_xyz[0], base_xyz[1], base_xyz[2], tip_xyz[0],
> base_color[1], base_color[2], tip_color[0], tip_color[1], tip_color[2], 1,
> 1]
>
>  # load it
>
>  # generate a pseudoatom for reference
> cmd.pseudoatom('point', pos=[2,5,4])
> cmd.show_as('nb_spheres', 'point')
>
>   ### end cone_cgo.py ###
>
>
>  and load it via `run cone_cgo.py`, then you can rotate the cone on its
> axis using, e.g.:
>
>  rotate [3,3,3], 10, object=cone, camera=0
>
>
>  Even with a radially symmetric cone surface, if you look closely, you
> can see the individual polygons changing at the cone base.  You can also
> rotate the scene around the cone axis with, e.g.:
>
>   rotate [3,3,3], 10
>
>
>  Hope that helps.
>
>  Cheers,
> Jared
>
> --
> Jared Sampson
> Xiangpeng Kong Lab
> NYU Langone Medical Center
> 550 First Avenue
> New York, NY 10016
> 212-263-7898
> http://kong.med.nyu.edu/
>
>
>
>
>
>
>  On Feb 17, 2014, at 2:40 PM, Paweł Tomaszewski <croov...@gmail.com>
> wrote:
>
>  Thank you Thomas
> Using camera=0 caused my cone not to do rotations related to the camera
> position.
> Cone still rotates not about itself, but about axis of global coordinate
> system.
> Do you have any other ideas?
>
>  Cheers,
>    Paweł
>
>
> 2014-02-06 17:00 GMT+01:00 Thomas Holder <thomas.hol...@schrodinger.com>:
>
>> Hi Pawel,
>>
>> have you tried using the camera=0 argument?
>>
>> cmd.rotate(axis, angle, object='yourcone', camera=0)
>>
>> Cheers,
>>   Thomas
>>
>>
>  On 05 Feb 2014, at 15:46, Павел Томашевский <croov...@gmail.com> wrote:
>>
>> > Hello
>> > I've made a cone CGO (something like a pointer) and now I need to make
>> a rotation of the cone. I have got yaw, pitch and roll angle values, but
>> when I do 'rotate' command it rotates about axis of the global coordinate
>> system.
>> >
>> > My question is, how to make a rotation of the CGO about axis that is
>> NOT of the global pymol coordinate system but goes through the CGO itself?
>> >
>> > I hope it's clear what I mean ;)
>> >
>> > Thank you
>> > Pawel
>>
>>
>>  --
>> Thomas Holder
>> PyMOL Developer
>> Schrödinger, Inc.
>>
>>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>
>
>  ------------------------------------------------------------
> This email message, including any attachments, is for the sole use of the
> intended recipient(s) and may contain information that is proprietary,
> confidential, and exempt from disclosure under applicable law. Any
> unauthorized review, use, disclosure, or distribution is prohibited. If you
> have received this email in error please notify the sender by return email
> and delete the original message. Please note, the recipient should check
> this email and any attachments for the presence of viruses. The
> organization accepts no liability for any damage caused by any virus
> transmitted by this email.
> =================================
>
```
```------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
```_______________________________________________