1
from math import cos, pi, sin2
from random import randint6
from numpy import matrix13
display = pygame.display14
surface = display.set_mode((WIDTH, HEIGHT))15
display.set_caption("3D")34
[[1, 0, 0], [0, cos(theta), -sin(theta)], [0, sin(theta), cos(theta)]]40
[[cos(theta), 0, -sin(theta)], [0, 1, 0], [sin(theta), 0, cos(theta)]]46
[[cos(theta), -sin(theta), 0], [sin(theta), cos(theta), 0], [0, 0, 1]]51
for e in pygame.event.get():52
if e.type == pygame.QUIT:56
pygame.draw.rect(surface, (0, 0, 0), pygame.Rect(0, 0, WIDTH, HEIGHT))62
m = matrix([[p[0]], [p[1]], [p[2]]])64
for method, angle in zip((generate_x, generate_y, generate_z), rotation):67
x, y, z = map(lambda x: int(WIDTH / 2 - x), (m[0, 0], m[1, 0], m[2, 0]))69
render_points.append((x, y))71
for p1 in range(len(render_points) - 1):72
for p2 in render_points[p1 + 1 :]:73
pygame.draw.line(surface, WHITE, render_points[p1], p2)75
rotation[0] += pi / randint(100, 200)76
rotation[1] += pi / randint(100, 200)