Ideal Polygon

class IdealPolygon(*angles: Sequence[float], disk: Disk, **kwargs)[source]

A polygon whose corners are ideal points.

Examples

Example: IdealPolygonExample

../_images/IdealPolygonExample-1.png
from manim import *

from hmanim.poincare import Disk, IdealPolygon

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

        sides = 5
        angles = [TAU * i / sides for i in range(sides)]
        ideal_polygon = IdealPolygon(
            *angles,
            disk=disk,
            color=BLUE,
        )
        self.add(ideal_polygon)
from hmanim.poincare import Disk, IdealPolygon

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

        sides = 5
        angles = [TAU * i / sides for i in range(sides)]
        ideal_polygon = IdealPolygon(
            *angles,
            disk=disk,
            color=BLUE,
        )
        self.add(ideal_polygon)

static ideal_length(k: int) float[source]

Defines the distance between the center of an IdealPolygon and one of its sides.

Parameters:

k (int) – The number of sides of the ideal polygon.

Returns:

The distance between the center of the ideal polygon and one of its sides.

Return type:

float

Examples

Example: IdealPolygonLengthExample

../_images/IdealPolygonLengthExample-1.png
from manim import *

from hmanim.poincare import Disk, IdealPolygon

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

        sides = 5
        angles = [TAU * i / sides for i in range(sides)]
        ideal_polygon = IdealPolygon(
            *angles,
            disk=disk,
            color=BLUE,
        )
        self.add(ideal_polygon)

        length = IdealPolygon.ideal_length(sides)
        translated_polygon = ideal_polygon.copy().translated_by(
                2 * length
            ).rotated_by(TAU / (2 * sides)).set_color(RED)
        self.add(translated_polygon)
from hmanim.poincare import Disk, IdealPolygon

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

        sides = 5
        angles = [TAU * i / sides for i in range(sides)]
        ideal_polygon = IdealPolygon(
            *angles,
            disk=disk,
            color=BLUE,
        )
        self.add(ideal_polygon)

        length = IdealPolygon.ideal_length(sides)
        translated_polygon = ideal_polygon.copy().translated_by(
                2 * length
            ).rotated_by(TAU / (2 * sides)).set_color(RED)
        self.add(translated_polygon)