How to move/center the linear transformation of the plane?

25 Views Asked by At

I'm new in Manim and I'm trying to scale my plane because the grid and vectors get out under the following linear transformation

class LinearTransformationSceneExample(LinearTransformationScene):
    def __init__(self, **kwargs):
        LinearTransformationScene.__init__(
            self,
            show_coordinates=True,
            leave_ghost_vectors=True,
            *kwargs
        )

    def construct(self):
        matrix = [[9, 0], [-3/2, 3/2]]
        self.apply_matrix(matrix)
        self.wait()

I tried many things, but withput any success. However, the closest I have come has been with the following code, but the linear transformation is applied in the center of the plane

class LinearTransformationSceneExample(LinearTransformationScene):
    def __init__(self, **kwargs):
        LinearTransformationScene.__init__(
            self,
            show_coordinates=True,
            leave_ghost_vectors=True,
            background_plane_kwargs = {
            "x_range" : [-10,10],
            "y_range" : [-1,10],
            "x_length" : 14.2,
            "y_length" : 8
            },
            foreground_plane_kwargs = {
            "x_range" : [-10,10],
            "y_range" : [-1,10],
            "x_length" : 14.2,
            "y_length" : 8
            }
        )

    def construct(self):
        vec = Vector([-1,1])
        vec.set_color(PURPLE)
        self.add_vector(vec)
      
        matrix = [[9, 0], [-3/2, 3/2]]
        self.apply_matrix(matrix)
        self.wait()

If you can follow the idea of the code above it'd be great, but it's not really necessary

0

There are 0 best solutions below