Automatic checking Rectangle Construction

Tool: IntersectionPoint
IntersectionPoint[ <Punkt>, <Punkt>, <Punkt> ]
Input: A, B, C
Output: D

a = Segment(A, B)
b = OrthogonalLine(B, a)
c = Line(C, a)
d = OrthogonalLine(A, a)
D = Intersect(c, d)

Tool: Rectangle
Input: D, E, F
Output: poly1

e = Segment(D, E)
f = OrthogonalLine(D, e)
l = OrthogonalLine(E, e)
m = OrthogonalLine(F, l)
L = Intersect(l, m)
M = Intersect(f, m)
poly1, d_1, e_1, l_1, m_1 = Polygon(D, E, L, M)

Tool: Square
Input: D, E
Output: poly1

poly1, e, f, l, m, F, L = Polygon(D, E, 4)