G.178 magnitude multiple magnitude — Code

V.5

If a magnitude be the same multiple of a magnitude that a part subtracted is of a part subtracted, the remainder is the same multiple of the remainder that the whole is of the whole.
A E B G C F D
"""Programmatic construction for Book V, Proposition 5 (V.5)."""

        from __future__ import annotations

        from geometor.model import Model


        def construct_g1() -> Model:
            """Construct the figure 0151.g1 for Book V, Proposition 5 using geometor.model."""
            model = Model("V.5")

            # Magnitude AB subdivided at E (with intermediate multiple marks A_1, A_2, E_1, E_2)
            A = model.set_point(22.0, -33.0, classes=["given"], ID="A")
            A_1 = model.set_point(77.0, -33.0, ID="A_1")
            A_2 = model.set_point(133.0, -33.0, ID="A_2")
            E = model.set_point(188.0, -33.0, classes=["given"], ID="E")
            E_1 = model.set_point(225.0, -33.0, ID="E_1")
            E_2 = model.set_point(261.0, -33.0, ID="E_2")
            B = model.set_point(298.0, -33.0, classes=["given"], ID="B")

            # Magnitude GD subdivided at C and F
            G = model.set_point(101.0, -62.0, ID="G")
            C = model.set_point(142.0, -62.0, classes=["given"], ID="C")
            F = model.set_point(195.0, -62.0, classes=["given"], ID="F")
            D = model.set_point(235.0, -62.0, classes=["given"], ID="D")

            # Base lines
            model.construct_line(A, B)
            model.construct_line(G, D)

            # Segments on AB
            model.set_segment(A, B)
            model.set_segment(A, E)
            model.set_segment(E, B)

            # Segments on GD
            model.set_segment(G, D)
            model.set_segment(C, D)
            model.set_segment(C, F)
            model.set_segment(F, D)
            model.set_segment(C, G)
            model.set_segment(G, F)

            return model


        if __name__ == "__main__":
            construct_g1()