Line

class Line(p1: Point, p2: Point, disk: Disk, **kwargs)[source]

The Poincaré disk equivalent to Manim’s Line. Lines are actually line segments that follow the geodesic between two points.

Examples

Example: LineExample

../_images/LineExample-2.png
from manim import *

from hmanim.poincare import Disk, Line, IdealPoint, Point

class LineExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        ideal_line = Line(
            IdealPoint(angle=0),
            IdealPoint(angle=TAU / 4),
            disk=disk,
            color=RED,
        )
        self.add(ideal_line)
from hmanim.poincare import Disk, Line, IdealPoint, Point

class LineExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        ideal_line = Line(
            IdealPoint(angle=0),
            IdealPoint(angle=TAU / 4),
            disk=disk,
            color=RED,
        )
        self.add(ideal_line)

copy() Line[source]

Create a copy of the line.

Returns:

The copy of the line.

Return type:

Line

move_to(p1: Point, p2: Point) Line[source]

Move the line to new end points.

Parameters:
Returns:

The line with the new end points.

Return type:

Line

Examples

Example: LineMoveToExample

from manim import *

from hmanim.poincare import Disk, Line, Point

class LineMoveToExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        self.play(line.animate(run_time=3).move_to(
            Point(0.75, 0.0),
            Point(0.25, 0.5),
        ))
from hmanim.poincare import Disk, Line, Point

class LineMoveToExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        self.play(line.animate(run_time=3).move_to(
            Point(0.75, 0.0),
            Point(0.25, 0.5),
        ))

translated_by(distance: float) Line[source]

Translate the line by the passed distance in positive direction parallel to the x-axis. A negative distance translates the line in negative x-direction.

Parameters:

distance (float) – The distance to translate the line by.

Returns:

The translated line.

Return type:

Line

class LineRotate(mobject=None, *args, use_override=True, **kwargs)[source]

A rotation of the endpoints of the line around the origin by the passed angle.

Examples

Example: LineRotateExample

from manim import *

from hmanim.poincare import Disk, Line, LineRotate, Point

class LineRotateExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        self.play(LineRotate(line, TAU / 2))
from hmanim.poincare import Disk, Line, LineRotate, Point

class LineRotateExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        self.play(LineRotate(line, TAU / 2))

interpolate_mobject(alpha: float) None[source]

Interpolates the mobject of the Animation based on alpha value.

Parameters:

alpha – A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.

class LineTranslate(mobject=None, *args, use_override=True, **kwargs)[source]

A ‘translation’ of both endpoints along the x-axis by the passed distance.

Examples

Example: LineTranslateExample

from manim import *

from hmanim.poincare import Disk, Line, LineTranslate, Point

class LineTranslateExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        self.play(LineTranslate(line, 3))
from hmanim.poincare import Disk, Line, LineTranslate, Point

class LineTranslateExample(Scene):
    def construct(self):
        disk = Disk(
            radius=3,
            color=WHITE,
        )
        self.add(disk)

        line = Line(
            Point(-0.75, 0.0),
            Point(-0.25, 0.5),
            disk=disk,
            color=BLUE,
        )
        self.add(line)

        self.play(LineTranslate(line, 3))

interpolate_mobject(alpha: float) None[source]

Interpolates the mobject of the Animation based on alpha value.

Parameters:

alpha – A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.