Question Regarding Creating Right Angle in Manim

Viewed 219

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 Answers

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] )
        line_list.arrange_in_grid(buff=1.5)
        self.add(
            line_list
        )

Source: here

Related