how to assign data from a matrix to several objects in python

0

Good day to all I am programmed a movement in Vpython for which I used a "for" loop that allowed me to create a number of 20 spheres in random positions stored in matrices, after that use a second "for" that It allowed me to create the new positions of the particles every certain distance. This is the first for:

for i in range(nsphere):

    x =uniform(-15, 15)
    y =uniform(-15, 15)
    z = -6
    a =uniform(0.01, 0.5)
    r =uniform(0.3, 0.8)

    esferas = esferas + [sphere(pos=(x,y,z), radius=r, color=colors[i % 6],
                                make_trail=True, interval=10)]
    trayectoria = trayectoria + [curve(pos=(x,y,z), radius=r, color=colors[i % 6],
                                make_trail=True, interval=10)]

    poslist.append((x,y,z))
    xlist.append(x)
    ylist.append(y)
    MP1.append([[x],[a]])
    MP2.append([[y],[a]])

This is the second for:

for i in range(nsphere):



         NFX1=M(6)*pot1[i]
         NFY1=M(6)*pot2[i]

         NFX2=M(1)*MQF(3)*NFX1
         NFY2=M(1)*MQD(3)*NFX1

         NFX3=MQD(3)*NFX2
         NFY3=MQF(3)*NFY2

         NFX4=M(1)*NFX3
         NFY4=M(1)*NFX3

The problem is that I have not been able to assign the new positions of the second for loop in the particles created in the first for loop, I request advice or help, thank you very much

    
asked by GERMAIN NICOLAS MORALES SUAREZ 18.07.2018 в 23:16
source

0 answers