G.368 many numbers please — Code

IX.35

If as many numbers as we please be in continued proportion, and there be subtracted from the second and the last numbers equal to the first, then, as the excess of the second is to the first, so will the excess of the last be to all those before it.
A B G C D E L K H F
"""Programmatic construction for Book IX, Proposition 35 (IX.35)."""

        from __future__ import annotations

        from geometor.model import Model


        def construct_g1() -> Model:
            """Construct the figure 0426.g1 using geometor.model."""
            model = Model("IX.35")

            # Single-letter number segment A
            A_l = model.set_point(235.0, -13.0, classes=["given"], ID="A")
            A_r = model.set_point(265.0, -13.0, ID="A_r")

            # Subdivided number segment BC (divided at G)
            B = model.set_point(205.0, -28.5, classes=["given"], ID="B")
            G = model.set_point(235.0, -28.5, ID="G")
            C = model.set_point(265.0, -28.5, classes=["given"], ID="C")

            # Single-letter number segment D
            D_l = model.set_point(176.0, -53.0, classes=["given"], ID="D")
            D_r = model.set_point(267.0, -53.0, ID="D_r")

            # Subdivided number segment EF (divided at L, K, H)
            E = model.set_point(15.0, -78.0, classes=["given"], ID="E")
            L = model.set_point(176.0, -78.0, ID="L")
            K = model.set_point(205.0, -78.0, ID="K")
            H = model.set_point(235.0, -78.0, ID="H")
            F = model.set_point(266.0, -78.0, classes=["given"], ID="F")

            # Base lines for subdivided segments
            model.construct_line(B, C)
            model.construct_line(E, F)

            # Standalone segments A and D
            model.set_segment(A_l, A_r)
            model.set_segment(D_l, D_r)

            # Whole and subdivided segments on BC
            model.set_segment(B, C)
            model.set_segment(B, G)
            model.set_segment(G, C)

            # Whole and subdivided segments on EF
            model.set_segment(E, F)
            model.set_segment(E, L)
            model.set_segment(E, K)
            model.set_segment(E, H)
            model.set_segment(L, K)
            model.set_segment(L, H)
            model.set_segment(L, F)
            model.set_segment(K, H)
            model.set_segment(K, F)
            model.set_segment(H, F)

            # Collinear sections
            model.set_section([B, G, C])
            model.set_section([E, L, F])
            model.set_section([E, H, F])
            model.set_section([L, K, F])
            model.set_section([K, H, F])

            return model


        if __name__ == "__main__":
            construct_g1()