WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-16-2009, 12:17 PM
vijaykiran vijaykiran is offline
Member
 
Join Date: Sep 2009
Posts: 13
Smooth interpolation from a bunch of transformation matrices

Hello,

I was wondering what is the easiest way in Vizard 3.0 to do a smooth view interpolation if I have a bunch of 4x4 transformation matrices stored in a text file.

On a similar token, is there any sample code/example that comes with vizard that illustrates quaternion usage?

Thanks,
Vijay.
Reply With Quote
  #2  
Old 09-17-2009, 06:54 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use the vizmat.Interpolate function to linearly interpolate between the position values of the matrix:
Code:
pos = vizmat.Interpolate(pos1,pos2,0.5)
You can also use the vizmat.slerp function to perform spherical linear interpolation between quaternion values of the matrix:
Code:
quat = vizmat.slerp(quat1,quat2,0.5)
Viewpoint objects have a setQuat method that allows you to specify the rotation as a quaternion. Is this the usage you are looking for?
Reply With Quote
  #3  
Old 09-21-2009, 12:11 PM
vijaykiran vijaykiran is offline
Member
 
Join Date: Sep 2009
Posts: 13
farshizzo,

Thanks for the reply. I was sort of looking for this, but I would need to extract the position and quat info before using them.

Given a 4 x 4 transformation matrix, are there any routines that directly extracts the 'pos' and 'quat'?

Thanks,
Vijay.
Reply With Quote
  #4  
Old 09-22-2009, 12:01 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
If you have a list of 16 values representing the 4x4 matrix, then you can initialize a viz.Matrix object with it:
Code:
matrix_data = [1,2,3,...,16] # 4x4 matrix values

m = viz.Matrix(matrix_data) #Create matrix object
print m.getPosition() #Print position
print m.getQuat() #Print quaternion
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Jump


All times are GMT -7. The time now is 01:26 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC