manim visualization does not work, circle disapear insted of be mapped to line

42 Views Asked by At

I want to visualize how two circles behave under homography. So let f be complex function f(z)=(z-4)/(z-1). It is homography that map circle of radius 1 to straight line x=5/2 and circle of radius 2 to itself. I have following code:

from manim import * 
import numpy as np 
"manim -pql h.py homography"

class homography(LinearTransformationScene):
    def construct(self):
        circlea = Circle(radius=1.2, color=BLUE_B)
        circleb = Circle(radius=2, color=RED)
        self.play(
            ApplyPointwiseFunction(
                lambda point: complex_to_R3((R3_to_complex(point)-4)/(R3_to_complex(point)-1)) if R3_to_complex(point)!=1 else np.array([0., 0., 0.]),circlea
            )
        )
        self.play(
            ApplyPointwiseFunction(
                lambda point: complex_to_R3((R3_to_complex(point)-4)/(R3_to_complex(point)-1)) if R3_to_complex(point)!=1 else np.array([0., 0., 0.]),circleb
            )
        )
        
        self.wait()

And it works only partially. At the beginning circle of radius 1 is displayed and then it disapear, but should be mapped to the line I mentioned before. After a while second circle of radius 2 is mapped to itself as it should.

I map only one point of circle of radius 1 to 0 in order to avoid division by 0, however it seems like every point of circle of radius 1 disapear.

Why?

I think that z=2 might be problematic but I don't know why.

0

There are 0 best solutions below