简体   繁体   中英

How can I get a coordinate grid for certain coordinates on the X,Y and Z axis?

coordinates = []
repeats = 2  
grid_size = 4     
for c in itertools.product(range(grid_size), range(grid_size), range(grid_size)):
    for _ in range(repeats):
        coordinates.append(list(c))

until now I used this code because I had the same points on all the axis (0,1,2,3)

Now it has changed and I have 0,1,2,3 on the X axis 0,1,2,3,4,5,6 on the Y axis 0.1,0.6,1.3 on the Z axis

I want to repeat every coordinate 2 times by row, thats why I have repeats in the code

Thanks in advance!

The code I tried before:

coordinates = []
repeats = 2  
grid_size = 4     
for c in itertools.product(range(grid_size), range(grid_size), range(grid_size)):
    for _ in range(repeats):
        coordinates.append(list(c))

Use itertools.product(range(4), range(7), [0.1, 0.6, 1.3])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM