Question Regarding Creating Right Angle in Manim

I was recently making a program in the python manim library that included right angles. I tried searching up how to create right angles in manim, but could not find anything. I was wondering if anyone could help me in creating a right angle in the python manim library.

Thank you in advance.

1 answer

  • answered 2021-05-17 22:04 Polydynamical

    Use the RightAngle function.

    Here is a sample:

    from manim import *
    class RightAngleExample(Scene):
        def construct(self):
            line1 = Line( LEFT, RIGHT )
            line2 = Line( DOWN, UP )
            rightangles = [
                RightAngle(line1, line2),
                RightAngle(line1, line2, length=0.4, quadrant=(1,-1)),
                RightAngle(line1, line2, length=0.5, quadrant=(-1,1), stroke_width=8),
                RightAngle(line1, line2, length=0.7, quadrant=(-1,-1), color=RED),
            line_list = VGroup( *[VGroup() for k in range(4)] )
            for k in range(4):
                linea = line1.copy()
                lineb = line2.copy()
                line_list[k].add( linea )
                line_list[k].add( lineb )
                line_list[k].add( rightangles[k] )

    Source: here