我想创建一个'形成'为我的博伊兹遵循,但可以有任何数量的博伊兹在形成。我想要一个圆形的队形。那么,我如何通过构造中的boid数,并在那里操纵(x,y),使它们填充成一个圆形呢
我有:self.flock_formation = [] under class Flock.__init__ and self.pos(math3d.VectorN(x,y) under class Boid.__init__
这是在课堂上:
def create_formation(self):
for boid in range(0, len(self.boids)):
spot = math3d.VectorN(x, y)
self.flock_formation.append(spot)
我很难理解我可能需要做些什么来找出一个圈中的位置,这个圈的大小相当于群中的boid数量。任何想法或示例代码都会有所帮助,谢谢
你需要为你的圆选择一个半径。这里有一个算法
你能从那里拿走吗
相关问题 更多 >
编程相关推荐