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

Code before:

    def get_end(self) -> Point3D:
        return self.points[self.tip_index]

    def put_start_and_end_on(self, start: Point3DLike, end: Point3DLike) -> Self:
        self.set_points_by_ends(start, end, buff=0, path_arc=self.path_arc)
        return self

    def scale(self, *args: Any, **kwargs: Any) -> Self:
        super().scale(*args, **kwargs)
        self.reset_points_around_ends()
        return self

    def set_thickness(self, thickness: float) -> Self:
        self.thickness = thickness
        self.reset_points_around_ends()
        return self

    def set_path_arc(self, path_arc: float) -> None:
        self.path_arc = path_arc
        self.reset_points_around_ends()
        # return self


class OpenGLVector(OpenGLArrow):
    def __init__(self, direction: Vector3DLike = RIGHT, buff: float = 0, **kwargs: Any):
        self.buff = buff
        if len(direction) == 2:
            direction = np.hstack([direction, 0])
        super().__init__(ORIGIN, direction, buff=buff, **kwargs)


class OpenGLDoubleArrow(OpenGLArrow):
    def __init__(self, *args: Any, **kwargs: Any):
        super().__init__(*args, **kwargs)
        self.add_tip(at_start=True)


class OpenGLCubicBezier(OpenGLVMobject):
    def __init__(
        self,
        a0: Point3DLike,
        h0: Point3DLike,
        h1: Point3DLike,
        a1: Point3DLike,
        **kwargs: Any,
    ):
        super().__init__(**kwargs)
        self.add_cubic_bezier_curve(a0, h0, h1, a1)



Review comment (suggestion):
Since this constructor appends a 0 to the end of `direction` if it only contains 2 elements, 2D vectors are also intended to be accepted as directions.
```suggestion
    def __init__(
        self,
        direction: Vector2DLike | Vector3DLike = RIGHT,
        buff: float = 0,
        **kwargs: Any,
    ):
```

Code after:
            path_arc=self.path_arc,
        )
        return self

    def get_start(self) -> Point3D:
        nppc = self.n_points_per_curve
        points = self.points
        return (points[0] + points[-nppc]) / 2

    def get_end(self) -> Point3D:
        return self.points[self.tip_index]

    def put_start_and_end_on(self, start: Point3DLike, end: Point3DLike) -> Self:
        self.set_points_by_ends(start, end, buff=0, path_arc=self.path_arc)
        return self

    def scale(self, *args: Any, **kwargs: Any) -> Self:
        super().scale(*args, **kwargs)
        self.reset_points_around_ends()
        return self

    def set_thickness(self, thickness: float) -> Self:
        self.thickness = thickness
        self.reset_points_around_ends()
        return self

    def set_path_arc(self, path_arc: float) -> None:
        self.path_arc = path_arc
        self.reset_points_around_ends()
        # return self


class OpenGLVector(OpenGLArrow):
    def __init__(
        self,
        direction: Vector2DLike | Vector3DLike = RIGHT,
        buff: float = 0,
        **kwargs: Any,
    ):
        self.buff = buff
        if len(direction) == 2:
            direction = np.hstack([direction, 0])
        super().__init__(ORIGIN, direction, buff=buff, **kwargs)


class OpenGLDoubleArrow(OpenGLArrow):
    def __init__(self, *args: Any, **kwargs: Any):
        super().__init__(*args, **kwargs)
        self.add_tip(at_start=True)