예제 #1
0
 def render_scene(self):
     for j in range(self.image.height):
         y = self.image.y0 + j * self.image.y_step
         for i in range(self.image.width):
             x = self.image.x0 + i * self.image.x_step
             ray = Ray(self.camera.position,
                       Vector(x, y, 0) - self.camera.position)
             self.image.set_pixel_to_map(j, i, self.ray_trace(ray))
     return self.image
예제 #2
0
 def __init__(self, position, radius, material):
     self.position = Vector(position[0], position[1], position[2])
     self.radius = radius
     self.material = material
예제 #3
0
 def __init__(self, position=(0.0, 0.0, -1.0), direction=(0.0, 0.0, 0.0)):
     self.position = Vector(position[0], position[1], position[2])
     self.direction = Vector(direction[0], direction[1],
                             direction[2]).normalization() + self.position