Repository: ManimCommunity/manim
File: manim/mobject/mobject.py (Python)

Code before:
    def get_nadir(self):
        return self.get_edge_center(IN)

    def length_over_dim(self, dim):
        return self.reduce_across_dimension(
            np.max, np.max, dim
        ) - self.reduce_across_dimension(np.min, np.min, dim)

    def get_coord(self, dim, direction=ORIGIN):
        """Meant to generalize ``get_x``, ``get_y`` and ``get_z``"""
        return self.get_extremum_along_dim(dim=dim, key=direction[dim])

    def get_x(self, direction=ORIGIN):
        """Returns x coordinate of the center of the mobject as ``numpy.float64`` """
        return self.get_coord(0, direction)

    def get_y(self, direction=ORIGIN):
        """Returns y coordinate of the center of the mobject as ``numpy.float64`` """
        return self.get_coord(1, direction)

    def get_z(self, direction=ORIGIN):
        """Returns z coordinate of the center of the mobject as ``numpy.float64`` """
        return self.get_coord(2, direction)

    def get_start(self):
        """Returns the point, where the stroke that surrounds the mobject starts.  Type is a ``numpy.ndarray`` with 3 elements, e.g. [-1,0,0] """
        self.throw_error_if_no_points()
        if config["use_opengl_renderer"]:
            return np.array(self.data["points"][0])
        else:
            return np.array(self.points[0])

    def get_end(self):
        """Returns the point, where the stroke that surrounds the mobject ends.  Type is a ``numpy.ndarray`` with 3 elements, e.g. [+1,0,0] """
        self.throw_error_if_no_points()
        if config["use_opengl_renderer"]:
            return np.array(self.data["points"][-1])
        else:
            return np.array(self.points[-1])

    def get_start_and_end(self):
        """Returns starting and ending point of a stroke as a ``tuple``. """
        return self.get_start(), self.get_end()

    def point_from_proportion(self, alpha):
        raise NotImplementedError("Please override in a child class.")

    def get_pieces(self, n_pieces):
        template = self.copy()
        template.submobjects = []
        alphas = np.linspace(0, 1, n_pieces + 1)

Review comment (suggestion):
Should the part " Type is a ``numpy.ndarray`` with 3 elements, e.g. [-1,0,0] " be removed?
I think this is a bit long

Code after:
        return self.get_edge_center(OUT)

    def get_nadir(self):
        return self.get_edge_center(IN)

    def length_over_dim(self, dim):
        """Measure the length of an :class:`~.Mobject` in a certain direction."""
        return self.reduce_across_dimension(
            np.max, np.max, dim
        ) - self.reduce_across_dimension(np.min, np.min, dim)

    def get_coord(self, dim, direction=ORIGIN):
        """Meant to generalize ``get_x``, ``get_y`` and ``get_z``"""
        return self.get_extremum_along_dim(dim=dim, key=direction[dim])

    def get_x(self, direction=ORIGIN) -> np.float64:
        """Returns x coordinate of the center of the :class:`~.Mobject` as ``float`` """
        return self.get_coord(0, direction)

    def get_y(self, direction=ORIGIN) -> np.float64:
        """Returns y coordinate of the center of the :class:`~.Mobject` as ``float`` """
        return self.get_coord(1, direction)

    def get_z(self, direction=ORIGIN) -> np.float64:
        """Returns z coordinate of the center of the :class:`~.Mobject` as ``float`` """
        return self.get_coord(2, direction)

    def get_start(self):
        """Returns the point, where the stroke that surrounds the :class:`~.Mobject` starts."""
        self.throw_error_if_no_points()
        if config["use_opengl_renderer"]:
            return np.array(self.data["points"][0])
        else:
            return np.array(self.points[0])

    def get_end(self):
        """Returns the point, where the stroke that surrounds the :class:`~.Mobject` ends."""
        self.throw_error_if_no_points()
        if config["use_opengl_renderer"]:
            return np.array(self.data["points"][-1])
        else:
            return np.array(self.points[-1])

    def get_start_and_end(self):
        """Returns starting and ending point of a stroke as a ``tuple``. """
        return self.get_start(), self.get_end()

    def point_from_proportion(self, alpha):
        raise NotImplementedError("Please override in a child class.")

    def get_pieces(self, n_pieces):