- Code: Select all
`from __future__ import division`

from visual import *

ball1 = sphere(pos=vector(0,5,-5), radius=1, color=color.cyan)

ball2 = sphere(pos=vector(5,5,0), radius=1, color=color.blue)

ball3 = sphere(pos=vector(5,-5,0), radius=1, color=color.green)

ball4 = sphere(pos=vector(-5,5,0), radius=1, color=color.red)

ball5 = sphere(pos=vector(-5,-5,0), radius=1, color=color.orange)

ball6 = sphere(pos=vector(0,-5,5), radius=1, color=color.yellow)

ball7 = sphere(pos=vector(0,-5,-5), radius=1, color=color.blue)

ball8 = sphere(pos=vector(0,5,5), radius=1, color=color.red)

ba = arrow(pos=(ball1.pos), axis=(ball2.pos - ball1.pos), color=color.red)

bb = arrow(pos=(ball2.pos), axis=(ball3.pos - ball2.pos), color=color.red)

bc = arrow(pos=(ball3.pos), axis=(ball4.pos - ball8.pos), color=color.red)

bd = arrow(pos=(ball7.pos), axis=(ball1.pos - ball7.pos), color=color.red)

For the circle of spheres surrounding my cube I got the following but it is a total fail:

- Code: Select all
`theta = 0`

dtheta = pi/12

while theta<2*pi:

ball1 = sphere(pos=vector(cos(theta), sin(theta),0), radius=1, color=color.cyan)

theta = theta + dtheta