Ejemplo n.º 1
0
pygame.init()

# size = width, height = 320, 400
size = width, height = 625, 400
xoffset = 50
yoffset = 50
offset = xoffset/2, yoffset/2
screen = pygame.display.set_mode(size)

black = 0, 0, 0
white = 255, 255, 255
bgcolor = white

# We can now create a camera object.  This will be
# what we use to draw things to the screen.
camera = math3d.camera(width-xoffset, height-yoffset)

# We will be rotating eight different cubes.  The
# following vectors will be used to position each
# cube.
vec = math3d.vector
positions = [ vec(50, 50, 50), vec(-50, 50, 50),
              vec(-50, -50, 50), vec(50, -50, 50),
              vec(50, 50, -50), vec(-50, 50, -50),
              vec(-50, -50, -50), vec(50, -50, -50) ]
cube = []
for i in range(8):
   cube.append(math3d.wireframe('littlecube.dat',
       pos = positions[i], axis=positions[(i+1)%8]))

# For visual reference, we will also draw a
Ejemplo n.º 2
0
pygame.init()

# size = width, height = 320, 400
size = width, height = 625, 400
xoffset = 50
yoffset = 50
offset = xoffset/2, yoffset/2
screen = pygame.display.set_mode(size)

black = 0, 0, 0
white = 255, 255, 255
bgcolor = white

# We can now create a camera object.  This will be
# what we use to draw things to the screen.
camera = math3d.camera(width-xoffset, height-yoffset,
                   pos=math3d.vector(-500, 0, 0))

# We will be rotating eight different cubes.  The
# following vectors will be used to position each
# cube.

# All of the following is used by the "residue"
# from my initial program
vec = math3d.vector
positions = [ vec(50, 50, 50), vec(-50, 50, 50),
              vec(-50, -50, 50), vec(50, -50, 50),
              vec(50, 50, -50), vec(-50, 50, -50),
              vec(-50, -50, -50), vec(50, -50, -50) ]
cube = []

cube.append(math3d.wireframe('worm_middle_segment.dat',