G.482 area contained rational — Code

X.96

If an area be contained by a rational segment and a sixth apotome, the “side” of the area is a segment which produces with a medial area a medial whole.
A D E F G C B H I K L N P S O Q U V W R T M
"""Programmatic construction for Book X, Proposition 96 (X.96)."""

        from __future__ import annotations

        from geometor.model import Model


        def construct_g1() -> Model:
            """Construct the figure 0213.g1 using geometor.model."""
            model = Model("X.96")

            # Top rectangle AGKC divided by vertical segments DB, EH, FI
            A = model.set_point(18.5, -22.0, classes=["given"], ID="A")
            D = model.set_point(112.5, -22.0, classes=["given"], ID="D")
            E = model.set_point(207.5, -22.0, ID="E")
            F = model.set_point(264.5, -22.0, ID="F")
            G = model.set_point(300.5, -22.0, classes=["given"], ID="G")

            C = model.set_point(18.5, -101.0, classes=["given"], ID="C")
            B = model.set_point(112.5, -101.0, classes=["given"], ID="B")
            H = model.set_point(207.5, -101.0, ID="H")
            I = model.set_point(264.5, -101.0, ID="I")
            K = model.set_point(300.5, -101.0, ID="K")

            # Bottom square LPMR with internal lines SO, NT, and diameter PR intersecting at Q
            L = model.set_point(94.0, -128.0, ID="L")
            N = model.set_point(183.5, -128.0, ID="N")
            P = model.set_point(236.0, -128.0, ID="P")

            S = model.set_point(94.0, -180.5, ID="S")
            Q = model.set_point(183.5, -180.5, ID="Q")
            O = model.set_point(236.0, -180.5, ID="O")

            R = model.set_point(94.0, -268.0, ID="R")
            T = model.set_point(183.5, -268.0, ID="T")
            M = model.set_point(236.0, -268.0, ID="M")

            # Base lines
            for p1, p2 in [
                (A, G), (C, K), (A, C), (D, B), (E, H), (F, I), (G, K),
                (L, P), (S, O), (R, M), (L, R), (N, T), (P, M), (P, R),
            ]:
                model.construct_line(p1, p2)

            # Top and bottom collinear segments on AGKC
            for pts in ([A, D, E, F, G], [C, B, H, I, K]):
                for i in range(len(pts)):
                    for j in range(i + 1, len(pts)):
                        model.set_segment(pts[i], pts[j])

            # Vertical segments on AGKC
            for p1, p2 in [(A, C), (D, B), (E, H), (F, I), (G, K)]:
                model.set_segment(p1, p2)

            # Segments on square LPMR
            for pts in (
                [L, N, P],
                [S, Q, O],
                [R, T, M],
                [L, S, R],
                [N, Q, T],
                [P, O, M],
                [P, Q, R],
            ):
                for i in range(len(pts)):
                    for j in range(i + 1, len(pts)):
                        model.set_segment(pts[i], pts[j])

            # Collinear sections
            model.set_section([A, D, G])
            model.set_section([D, E, G])
            model.set_section([A, F, G])
            model.set_section([L, N, P])
            model.set_section([S, Q, O])
            model.set_section([R, T, M])
            model.set_section([L, S, R])
            model.set_section([N, Q, T])
            model.set_section([P, O, M])
            model.set_section([P, Q, R])

            # Polygons in AGKC
            model.set_polygon([A, G, K, C])  # AK
            model.set_polygon([A, D, B, C])  # AB
            model.set_polygon([D, G, K, B])  # DK / KD
            model.set_polygon([A, F, I, C])  # AI
            model.set_polygon([F, G, K, I])  # FK / KF
            model.set_polygon([D, E, H, B])  # DH
            model.set_polygon([E, G, K, H])  # EK
            model.set_polygon([E, F, I, H])  # EI
            model.set_polygon([A, E, H, C])  # AH
            model.set_polygon([D, F, I, B])  # DI

            # Polygons and Gnomon in LPMR
            model.set_polygon([L, P, M, R])  # LM
            model.set_polygon([N, P, O, Q])  # NO
            model.set_polygon([S, Q, T, R])  # ST / TS
            model.set_polygon([L, P, O, S])  # LO
            model.set_polygon([N, P, M, T])  # MN
            model.set_polygon([L, N, Q, S])  # LQ
            model.set_polygon([Q, O, M, T])  # QM
            model.set_polygon([L, N, T, R])  # LT
            model.set_polygon([S, O, M, R])  # SM
            model.set_polygon([L, N, Q, O, M, R])  # Gnomon UVW

            # Common angle LPM
            model.set_wedge(P, L, L, M)

            return model


        if __name__ == "__main__":
            construct_g1()