Ver primer tramo

Ver también el segundo

Y el tercero

A_1 = (1, 3)
B_1 = (1, -1)
C = (9, -1)
D = (9, 3)
polígono1, a, b, c, d = Polygon(A_1, B_1, C, D)
A = PointIn(polígono1)
PA = Point(a)
PB = Point(b)
PC = Point(c)
e = PolyLine(A_1, B_1, C, D, A_1)
P = Point(e)
s = If(x(P) ≟ x(PA), a, If[x(P) ≟ x(PC), c, If[y(P) ≟ y(PB), b, d]])
f = OrthogonalLine(P, s)
A' = Mirror(A, f)
PP: P + (1.0E-4 * (A' - P))
g = Ray(PP, A')
I = Intersect(g, e)
f2 = OrthogonalLine(I, f)
A'' = Mirror(A', f2)
B = PointIn(polígono1)
PD = Point(d)
u = Vector(A, P)
h = Ray(I + (1.0E-4 * (A'' - I)), A'')
i = false
j = false
k = false
v = Vector(P, I)
K = Intersect(h, e)
w = Vector(I, K)
A''' = Mirror(A'', I)
h2 = Ray(I + (1.0E-4 * (A''' - I)), A''')
Kbis = Intersect(h2, e)
w2 = Vector(I, Kbis)