G.465 segment produces rational — Code

X.83

To a segment which produces with a rational area a medial whole only one segment can be annexed which is incommensurable in square with the whole segment and which with the whole segment makes the sum of the squares on them medial, but twice the rectangle contained by them rational.
A B C D
"""Programmatic construction for Book X, Proposition 83 (X.83)."""

        from __future__ import annotations

        from geometor.model import Model


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

            # Straight line AD divided at B and C
            A = model.set_point(18.0, -18.0, classes=["given"], ID="A")
            B = model.set_point(74.0, -18.0, classes=["given"], ID="B")
            C = model.set_point(187.0, -18.0, classes=["given"], ID="C")
            D = model.set_point(211.0, -18.0, classes=["given"], ID="D")

            # Base line
            model.construct_line(A, D)

            # Segments
            model.set_segment(A, D)
            model.set_segment(A, C)
            model.set_segment(A, B)
            model.set_segment(B, D)
            model.set_segment(B, C)
            model.set_segment(C, D)

            # Sections
            model.set_section([A, B, C])
            model.set_section([A, B, D])
            model.set_section([A, C, D])
            model.set_section([B, C, D])

            return model


        if __name__ == "__main__":
            construct_g1()