Matrix output of "Iterate" node
Created by: elfnor
The new "Iterate" or "Iterate matrix transform" node would be more consistent with other nodes such as "Matrix Interpolation" if it only had a Matrix and number of iterations as inputs and a list of powers of the input matrix as ouput. It would also, I think, calculate faster.
I quickly wrote up a "Scripted Node" to show this. Sorry I havn't looked at writing full nodes yet.
from mathutils import Matrix
from sverchok.data_structure import Matrix_listing
id_matrix = [[[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0]]]
def sv_main(mat1=id_matrix, pows = 1):
in_sockets = [
['m', 'Matrix', mat1],
['s', 'powers', pows]
]
mat_in = Matrix(mat1[0])
result = Matrix(id_matrix[0])
mat_list = []
mat_list.append(result)
for i in range(pows):
result = result * mat_in
mat_list.append(result)
mat_out = Matrix_listing(mat_list)
out_sockets = [
['m', 'Mat out', mat_out]
]
return in_sockets, out_sockets