Tool = [[0 for x in xrange(3)] for y in xrange(len(xTool)-1)]
for l in xrange((len(xTool) - 1)):
Tool[l][0] = yTool[l]; Tool[l][1] = xTool[l]; Tool[l][2] = zTool[l]
I am starting with points coordinates, which are in 3 lists (xTool, yTool, zTool), representing respectively the x, y and z coordinates of all my points.
The aim here is to create a matrix of 3 columns and many rows (over 10,000), where each row represent the point's 3 coordinates. The next step I do is a vector transformation like so: (This has minor importance, only if you really want to understand what i'm doing
rTool = numpy.zeros_like(Tool)
for rt in xrange((len(xTool) - 1)):
rTool[rt][0] = (Tool[rt][0] * cos(angle)) - (Tool[rt][1] * sin(angle))
rTool[rt][1] = (Tool[rt][0] * sin(angle)) + (Tool[rt][1] * cos(angle))
rTool[rt][2] = Tool[rt][2]
Finally, what I'm trying to do is order my rTool in regards to my 2nd column ([1]). For instance, I printed 5 entries of my rTool. By sorting them according to the 2nd column, the last row should be the first. I am really struggling to do this, and I suspect it's because I have tuples instead of a real 3 column mathematical matrix.
[[ -584.89837646 -3648.6472168 402.177948 ]
[ -542.8659668 -3663.34545898 405.76959229]
[ -500.831604 -3678.04785156 409.32122803]
[ -458.79336548 -3692.75854492 412.7930603 ]
[ -416.74984741 -3637.48022461 416.15090942]]
Don't hesitate to ask for clarification and I hope you will be able to help me! Thanks.