Mein Ziel ist es, das image1 entlang seiner Position bis zu 180 Grad entlang des Rings zu bewegen. Ich habe versucht, verschiedene Dinge zu tun, aber nichts scheint zu funktionieren. Mein endgültiges Ziel ist es, beide Bilder entlang des Rings in verschiedene Richtungen zu bewegen und sie schließlich zu verschmelzen und sie verschwinden zu lassen. Ich bekomme den Fehler oben. Kannst du bitte helfen? Kannst du mir auch sagen, wie ich dieses Problem lösen kann?ValueError: Operanden konnten nicht zusammen mit Shapes gesendet werden (3,) (0,)
from visual import *
import numpy as np
x = 3
y = 0
z = 0
i = pi/3
c = 0.120239 # A.U/minute
r = 1
for theta in arange(0, 2*pi, 0.1): #range of theta values; 0 to
xunit = r * sin(theta)*cos(i) +x
yunit = r * sin(theta)*sin(i) +y
zunit = r*cos(theta) +z
ring = curve(color = color.white) #creates a curve
for theta in arange(0, 2*pi, 0.01):
ring.append(pos=(sin(theta)*cos(i) +x,sin(theta)*sin(i) +y,cos(theta) +z))
image1=sphere(pos=(2.5,-0.866,0),radius=0.02, color=color.yellow)
image2=sphere(pos=(2.5,-0.866,0),radius=0.02, color=color.yellow)
earth=sphere(pos=(-3,0,-0.4),color=color.yellow, radius =0.3,material=materials.earth) #creates the observer
d_c_p = pow((x-xunit)**2 + (y-yunit)**2 + (z-zunit)**2,0.5) #calculates the distance between the center and points on ring
d_n_p = abs(yunit + 0.4998112152755791) #calculates the distance to the nearest point
t1 = (d_c_p+d_n_p)/c
t0=d_c_p/c
t=t1-t0 #calculates the time it takes from one point to another
theta = []
t = []
dtheta = np.diff(theta) #calculates the difference in theta
dt = np.diff(t) #calculates the difference in t
speed = r*dtheta/dt #hence this calculates the speed
deltat = 0.005
t2=0
while True:
rate(5)
image2.pos = image2.pos + speed*deltat #increments the position of the image1
t2 = t2 + deltat