G.51 congruent triangles by ASA and AAS — Code

I.26

Triangles with two angles and one corresponding side equal are congruent (ASA / AAS).
Euclid's Elements, Book I, Proposition 26 Triangles ABC and DEF with point G on AB, GC joined, and point H on BC with AH joined. A B C G H D E F
"""Programmatic construction for Book I, Proposition 26 (I.26).

        If two triangles have the two angles equal to two angles respectively, and one
        side equal to one side, namely, either the side adjoining the equal angles, or
        that subtending one of the equal angles, they will also have the remaining sides
        equal to the remaining sides and the remaining angle to the remaining angle.
        """

        from __future__ import annotations

        from geometor.model import Model


        def construct_g1() -> Model:
            """Construct the figure for Book I, Proposition 26 using geometor.model."""
            model = Model("I.26")

            # 1. Left triangle ABC with auxiliary points G on AB and H on BC
            A = model.set_point(32.5, -19, classes=["given"], ID="A")
            B = model.set_point(13, -117, classes=["given"], ID="B")
            C = model.set_point(127, -117, classes=["given"], ID="C")
            G = model.set_point(26.5, -47, ID="G")
            H = model.set_point(97, -117, ID="H")

            # 2. Right triangle DEF
            D = model.set_point(224.5, -18.5, classes=["given"], ID="D")
            E = model.set_point(207.5, -117, classes=["given"], ID="E")
            F = model.set_point(317.5, -117, classes=["given"], ID="F")

            # Segments and collinear sub-segments of ABC
            model.set_segment(A, B)
            model.set_segment(B, G)
            model.set_segment(A, G)
            model.set_section([A, G, B])

            model.set_segment(B, C)
            model.set_segment(B, H)
            model.set_segment(H, C)
            model.set_section([B, H, C])

            model.set_segment(A, C)
            model.set_segment(G, C)
            model.set_segment(A, H)

            # Polygons in left figure
            model.set_polygon([A, B, C])
            model.set_polygon([G, B, C])
            model.set_polygon([A, G, C])
            model.set_polygon([A, B, H])
            model.set_polygon([A, H, C])

            # Segments and polygon of DEF
            model.set_segment(D, E)
            model.set_segment(D, F)
            model.set_segment(E, F)
            model.set_polygon([D, E, F])

            # Angles (wedges)
            model.set_wedge(B, A, A, C)
            model.set_wedge(C, B, B, A)
            model.set_wedge(A, B, B, C)
            model.set_wedge(C, G, G, B)
            model.set_wedge(H, B, B, A)

            model.set_wedge(E, D, D, F)
            model.set_wedge(F, E, E, D)
            model.set_wedge(D, E, E, F)

            return model


        if __name__ == "__main__":
            construct_g1()