WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Smooth interpolation from a bunch of transformation matrices (https://forum.worldviz.com/showthread.php?t=2268)

vijaykiran 09-16-2009 11:17 AM

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.

farshizzo 09-17-2009 05:54 PM

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?

vijaykiran 09-21-2009 11:11 AM

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.

farshizzo 09-22-2009 11:01 AM

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



All times are GMT -7. The time now is 09:47 AM.

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