#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
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) Code:
quat = vizmat.slerp(quat1,quat2,0.5) |
#3
|
|||
|
|||
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. |
#4
|
|||
|
|||
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 |
|
|