Repository: ManimCommunity/manim
File: manim/camera/three_d_camera.py (Python)

Code before:

    @frame_center.setter
    def frame_center(self, point: Point3DLike) -> None:
        self._frame_center.move_to(point)

    def capture_mobjects(self, mobjects: Iterable[Mobject], **kwargs: Any) -> None:
        self.reset_rotation_matrix()
        super().capture_mobjects(mobjects, **kwargs)

    def get_value_trackers(self) -> list[ValueTracker]:
        """A list of :class:`ValueTrackers <.ValueTracker>` of phi, theta, focal_distance,
        gamma and zoom.

        Returns
        -------
        list
            list of ValueTracker objects
        """
        return [
            self.phi_tracker,
            self.theta_tracker,
            self.focal_distance_tracker,
            self.gamma_tracker,
            self.zoom_tracker,
        ]

    # TODO: Find a better way
    def modified_rgbas(self, vmobject: VMobject, rgbas: MatrixMN) -> MatrixMN:
        if not self.should_apply_shading:
            return rgbas
        if vmobject.shade_in_3d and (vmobject.get_num_points() > 0):
            light_source_point = self.light_source.points[0]
            if len(rgbas) < 2:
                shaded_rgbas = rgbas.repeat(2, axis=0)
            else:
                shaded_rgbas = np.array(rgbas[:2])
            shaded_rgbas[0, :3] = get_shaded_rgb(
                shaded_rgbas[0, :3],
                get_3d_vmob_start_corner(vmobject),
                get_3d_vmob_start_corner_unit_normal(vmobject),
                light_source_point,
            )
            shaded_rgbas[1, :3] = get_shaded_rgb(
                shaded_rgbas[1, :3],
                get_3d_vmob_end_corner(vmobject),
                get_3d_vmob_end_corner_unit_normal(vmobject),
                light_source_point,
            )
            return shaded_rgbas
        return rgbas


Review comment (suggestion):
A comment rather than a suggestion for this PR.

`MatrixMN` seems like the most fit alias _for now_, but we should actually make a new alias specifically for RGBA arrays, since `MatrixMN` is more fit for matrices representing linear maps which are applied on vectors. This was actually part of a larger proposal I wrote a long time ago [in a #development post on Discord](https://discord.com/channels/581738731934056449/1349098335566561502/1349098335566561502).

Code after:
    @frame_center.setter
    def frame_center(self, point: Point3DLike) -> None:
        self._frame_center.move_to(point)

    def capture_mobjects(self, mobjects: Iterable[Mobject], **kwargs: Any) -> None:
        self.reset_rotation_matrix()
        super().capture_mobjects(mobjects, **kwargs)

    def get_value_trackers(self) -> list[ValueTracker]:
        """A list of :class:`ValueTrackers <.ValueTracker>` of phi, theta, focal_distance,
        gamma and zoom.

        Returns
        -------
        list
            list of ValueTracker objects
        """
        return [
            self.phi_tracker,
            self.theta_tracker,
            self.focal_distance_tracker,
            self.gamma_tracker,
            self.zoom_tracker,
        ]

    def modified_rgbas(self, vmobject: VMobject, rgbas: MatrixMN) -> MatrixMN:
        if not self.should_apply_shading:
            return rgbas
        if vmobject.shade_in_3d and (vmobject.get_num_points() > 0):
            light_source_point = self.light_source.points[0]
            if len(rgbas) < 2:
                shaded_rgbas = rgbas.repeat(2, axis=0)
            else:
                shaded_rgbas = np.array(rgbas[:2])
            shaded_rgbas[0, :3] = get_shaded_rgb(
                shaded_rgbas[0, :3],
                get_3d_vmob_start_corner(vmobject),
                get_3d_vmob_start_corner_unit_normal(vmobject),
                light_source_point,
            )
            shaded_rgbas[1, :3] = get_shaded_rgb(
                shaded_rgbas[1, :3],
                get_3d_vmob_end_corner(vmobject),
                get_3d_vmob_end_corner_unit_normal(vmobject),
                light_source_point,
            )
            return shaded_rgbas
        return rgbas

    def get_stroke_rgbas(
        self,