@@ -0,0 +1,1679 @@
+import pygame%0A%0Afrom lab_2.camera2d import Camera2D%0Afrom lab_3.vector3d import Vector%0Afrom util.matrix import Matrix%0A%0A%0Aclass Camera3D(Camera2D):%0A    def __init__(self, title: str = %22Lab 3%22,%0A                 left: float = -2, right: float = 2,%0A                 bottom: float = -2, top: float = 2,%0A                 width: int = 600, height: int = 600,%0A                 screen_center: Vector = Vector(0, 0, -3), normal: Vector = Vector(0, 0, 1),%0A                 top_direction: Vector = Vector(0, 1, 0), distance: float = 10):%0A        super().__init__(title, left, right, bottom, top, width, height)%0A%0A        self.Ov = screen_center%0A        self.N = normal%0A        self.Top = top_direction%0A        self.D = distance%0A%0A        self.__S_w_to_v = None%0A        self.__S_v_to_p = None%0A        self.__S_w_to_p = None%0A        self._calc_matrices()%0A%0A    @property%0A    def world_to_view(self):%0A        return self.__S_w_to_v%0A%0A    @property%0A    def view_to_project(self):%0A        return self.__S_v_to_p%0A%0A    @property%0A    def world_to_project(self):%0A        return self.__S_w_to_p%0A%0A    def _calc_matrices(self):%0A        kv = self.N.normalised()%0A        iv = self.Top.cross_product(self.N).normalised()%0A        jv = kv.cross_product(iv)%0A        self.__S_w_to_v = Matrix(%5B%0A            %5Biv.x, iv.y, iv.z, -iv.dot(self.Ov)%5D,%0A            %5Bjv.x, jv.y, jv.z, -jv.dot(self.Ov)%5D,%0A            %5Bkv.x, kv.y, kv.z, -kv.dot(self.Ov)%5D,%0A            %5B0,       0,    0,                1%5D%0A        %5D)%0A        self.__S_v_to_p = Matrix(%5B%0A            %5B1, 0,           0, 0%5D,%0A            %5B0, 1,           0, 0%5D,%0A            %5B0, 0, -1 / self.D, 1%5D%0A        %5D)%0A        self.__S_w_to_p = self.__S_v_to_p * self.__S_w_to_v%0A

add Camera3D