WorldViz User Forum Varying rotation speed with spinTo
 Register FAQ Search Today's Posts Mark Forums Read

#1
03-19-2013, 11:00 AM
 mape2k Member Join Date: Mar 2013 Posts: 60
Varying rotation speed with spinTo

Hello,

I am using the spinTo command in a for loop to spin to different view angles during an experiment. I want the rotation speed to be constant, independent from the actual and desired view angle.
However, the spinTo command gives me different rotation speeds when I use it. Sometimes its faster, and sometimes its slower, even though I specify a constant speed angle.

I have attached a working minimum example. Here, the speed will vary, seemingly at random.

Code:
```import viztask
import viz
import vizact

angles = [-120,150,100,150,-170,50,90,150]

view=viz.MainView

def run():

for k in angles:
print str(k)

viz.go()```
#2
03-20-2013, 08:23 AM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
This appears to be a bug with how the rotational differences are computed. It doesn't seem to be using the shortest distance in all cases. This will be fixed in the next release. In the meantime you can add the following code to the beginning of your script to get the correct behavior:
Code:
```import math
import vizmat
def QuatDiff(q1,q2):
w = abs((vizmat.Quat(q1) * vizmat.Quat(q2).inverse()).w)
return viz.degrees(math.acos(w) * 2.0)
vizmat.QuatDiff = QuatDiff```
#3
03-22-2013, 07:48 AM
 mape2k Member Join Date: Mar 2013 Posts: 60

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post mhead10 Vizard 9 11-26-2012 12:06 PM Saz Vizard 1 05-20-2010 04:03 AM munteanu24d Vizard 0 03-23-2010 04:25 AM vijaykiran Vizard 2 09-29-2009 08:39 AM durf Vizard 1 03-13-2009 10:25 AM

All times are GMT -7. The time now is 06:23 PM.