Jared, my haptic device is SensAble Phantom Omni and now it is called
Geomagic Touch. I work on integration it with PyMOL and VRPN.

So far so good, but now I have a little more complicated problem with
rotate and translate functions.

When I set camera=0 in both of them, it doesn't matter if I move the screen
with mouse or not - my cone rotations and translations are absolute to the
global origin.
But when I don't set camera=0 option translations of the cone still works
well but rotations don't.

I think this is because translate function gets coordinates that are not
absolute to the origin but it gets changes - I mean [dx, dy, dz], where
dx=|x-x0|, x is current position and x0 is previous position (the same with
dy and dz). On the other hand rotate function gets origin option params as
absolute values, here [x, y, z] are cone position. Now after turning camera
with mouse translations of the cone are relative to camera position but
origin of rotation is absolute to main coordinate system position.

In this situation I have two origins: origin of rotations that is equal to
position of the cone and some global PyMOL origin where everything begins.

I hope it's clear so far ;)

Now, is it possible to change the origin of rotation not with values that
are absolute to the global origin but with changes relative to it's
previous position. Or maybe I should ask: "Is it possible to CHANGE origin
of rotation, not to SET it?".

I know it's a little complicated to explain what I mean using words, but I
hope I succeeded here ;)

Cheers,
Paweł




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

>  Hi Pawel -
>
>  Glad you were able to make it work.  Also, that haptic device (I guess
> the new version is the Geomagic Touch?) looks pretty neat.
>
>  I'm now realizing that when you asked "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" you probably didn't necessarily mean a rotation
> about the cone's primary axis, because that doesn't really do a whole lot
> unless your object isn't radially symmetric!
>
>  For correctness' sake, however, I need to amend my previous response.
>  It turns out I chose unfortunate values for the cone base and tip
> positions in my example, which resulted in the cone axis going through the
> global coordinate origin.  My previous attempt fails for cones that don't
> point at or away from the origin.  Whoops!
>
>  Thomas'  suggestion about the origin argument fixes it, though.  So for
> my example, I'd also need either the tip or the base position:
>
>  # print the values to use later
> print "tip_xyz = %s" % tip_xyz   # need this, too!
> print "axis = %s" % cone_axis
>
>
>  and then rotate the cone with, e.g.:
>
>  rotate [3,3,3], 10, object=cone, camera=0, origin=[4,5,6]
>
>
>  or everything with, e.g.:
>
>   rotate [3,3,3], 10, origin=[4,5,6]
>
>
>  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 18, 2014, at 2:04 PM, Paweł Tomaszewski <croov...@gmail.com>
>  wrote:
>
>  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],
>> 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]
>>
>>  # load it
>> cmd.load_cgo(obj, 'cone')
>>
>>  # 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.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk_______________________________________________
>> 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.
> Read the Whitepaper.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk_______________________________________________
> 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.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
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

Reply via email to