I'm absolutely sure this question must have been asked multiple times before, but for the life of me i couldn't find a thread answering this question:
I am making a model exporter where i want to calculate the minimum and maximum bounds of each object, by going through a list of vertices and picking the lowest and highest x, y, and z values into their own min/max tuple on the same form. The way i do this right now is like this:
x = max(vertices,key=itemgetter(0))[0] y = max(vertices,key=itemgetter(1))[1] z = max(vertices,key=itemgetter(2))[2] extents_max = (x, y, z) x = min(vertices,key=itemgetter(0))[0] y = min(vertices,key=itemgetter(1))[1] z = min(vertices,key=itemgetter(2))[2] extents_min = (x, y, z) And this works, but is there a more elegant, one-liner way of doing this in python?
verticesmight look like?yandzrespectively?verticesand a bit more of the code