I am trying to perform operations on specific elements within a 3d array in python. Here is an example of the array:
[[[ 0.5 0.5 50. ]
[ 50.5 50.5 100. ]
[ 0.5 100.5 50. ]
[ 135. 90. 45. ]]
[[ 50.5 50.5 100. ]
[ 100.5 0.5 50. ]
[ 100.5 100.5 50. ]
[ 45. 90. 45. ]]
[[ 100.5 100.5 50. ]
[ 100.5 100.5 0. ]
[ 0.5 100.5 50. ]
[ 90. 0. 90. ]]
An example of what I need to to is take the three values seen in the array i.e. 0.5, 0.5, 50. and take the first element from the 4th row i.e. 135. and send those four elements into a function. the function then returns new values for the 3 elements which need to be put into the array.
I am quite new to python so I'm having trouble getting it to work. Should I be making a loop? or something else?
Thanks Nick
An attempt at a solution:
b = shape(a)
triangles = b[0]
for k in range(0,triangles):
for i in range(0,2):
a[k,i,:] = VectMath.rotate_x(a[k,i,0],a[k,i,1],a[k,i,2],a[k,3,2])