Vectorizing the creation of 3D coordinates

How can I generate an array of all integer (x, y, z) points in the specified ranges of each axis without doing a triple loop? Something better than this ... (I looked at the meshgrid functions, but don't understand how to apply them here).

points = []
for i in range(-x,x):
    for j in range(-y,y):
        for k in range(-z,z):
            points.append((i,j,k))

      

+3


source to share





All Articles