Open jpasserin opened 2 years ago
Looks like there is still an issue. it seems that when passing an Array of Matrix3 the output quaternion array is an array of the last item.
from math3d import Matrix3, Matrix3Array
m = Matrix3Array(
[Matrix3([1,0,0,0,1,0,0,0,1])]
)
print(m)
# [[[1. 0. 0.]
# [0. 1. 0.]
# [0. 0. 1.]]]
print(m.asQuaternionArray())
# Correct Result, when passing only one matrix3
# [[0. 0. 0. 1.]]
But when passing two matrices
from math3d import Matrix3, Matrix3Array
m = Matrix3Array([
Matrix3([1,0,0,0,1,0,0,0,1]),
Matrix3([.707,0,.707,0,1,0,-.707,0,.707])]
)
print(m)
# [[[ 1. 0. 0. ]
# [ 0. 1. 0. ]
# [ 0. 0. 1. ]]
# [[ 0.707 0. 0.707]
# [ 0. 1. 0. ]
# [-0.707 0. 0.707]]]
print(m.asQuaternionArray())
# This is seems to be the second matrix twice
# [[0. 0.38263761 0. 0.92385064]
# [0. 0.38263761 0. 0.92385064]]
# Should be
# [[0. 0. 0. 1.]
# [0. 0.38263761 0. 0.92385064]]
OK, should work now.
I found an alternate algorithm for Matrix3 to Quaternion which gave me the correct result