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 :
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_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], tip_xyz[1], tip_xyz[2], base_radius, tip_radius, base_color[0], base_color[1], base_color[2], tip_color[0], tip_color[1], tip_color[2], 1, 1]

# 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 <crooveck@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 :
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, Павел Томашевский <crooveck@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.