Пример #1
0
 def get_color(self, point: geometry.Point) -> Color:
     local = self.projection(point)
     x = geometry.get_x(local)
     y = geometry.get_y(local)
     if (self._get_square_index(x) + self._get_square_index(y)) % 2:
         return self.darker
     return self.lighter
Пример #2
0
def _draw(color: Color, image: Image, point: geometry.Point) -> None:
    x = int(geometry.get_x(point))
    y = int(geometry.get_y(point))
    image.set_pixel(x, y, color)
Пример #3
0
 def project_to_local_xz(point: geometry.Point) -> geometry.Point:
     return geometry.make_point(geometry.get_x(point),
                                geometry.get_z(point), 0)
Пример #4
0
def test_make_point():
    point = Point(1, 2, 3)
    assert geometry.get_x(point) == 1
    assert geometry.get_y(point) == 2
    assert geometry.get_z(point) == 3