n_1

n_2

r

radiocircunferencia = 2.55 (slider from 0.1 to 5, step 0.01)
A = Intersect(xAxis, yAxis)
c = Circle(A, radiocircunferencia)
B_1, C_1 = Intersect(c, yAxis)
f = Line(A, xAxis)
B = Intersect(c, f, 1)
k = Circle(B, A)
d = CircumcircleArc(B_1, B, C_1)
E, H = Intersect(d, k)
p_1 = CircumcircleArc(E, B, H)
P = Point(Ray[(x(B) - radiocircunferencia, 0), Vector[(-1, 0)]])
C = Point(p_1)
h = Ray(A, C)
i_1 = Segment(P, C)
n_1 = 1.34 (slider from 1 to 2.5, step 0.01)
n_2 = 2.24 (slider from 1 to 2.5, step 0.01)
D = Intersect(Circle[A, (3 * radiocircunferencia)], h)
i = Angle(D, C, P)
A' = If(y(C) > 0, Rotate[A, asind((n_1 / n_2 * sin(i))), C], Rotate[A, (-asind((n_1 / n_2 * sin(i)))), C])
g = Ray(C, A')
Q = Intersect(f, g)
q = Angle(C, Q, A)
r = Angle(A, C, Q)
p = Angle(B, P, C)
j = Segment(C, Q)
l = Segment(A, D)
m = Line((x(B_1), y(B_1) - 0.5), xAxis)
n = Line((x(B_1), y(B_1) - 1), xAxis)
F = If(x(P) < -6, (x(P) - 2, 0), (-8, 0))
G = If(x(Q) > 4, (x(Q) + 2, 0), (6, 0))
s = Segment(F, G)
t = OrthogonalLine(P, f)
a = OrthogonalLine(B, f)
b = OrthogonalLine(A, f)
e = OrthogonalLine(Q, f)
I = Intersect(m, t)
J = Intersect(n, t)
K = Intersect(m, e)
L = Intersect(n, e)
M = Intersect(m, a)
N = Intersect(n, b)
f_1 = Segment(P, J)
g_1 = Segment(B, M)
h_1 = Segment(A, N)
j_1 = Segment(Q, L)
d_0 = Vector(Midpoint[Segment[I, M]], I)
v = Vector(Midpoint[Segment[I, M]], M)
d_i = Vector(Midpoint[Segment[M, K]], M)
u_1 = Vector(Midpoint[Segment[M, K]], K)
g_0 = Vector(Midpoint[Segment[J, N]], J)
w_1 = Vector(Midpoint[Segment[J, N]], N)
g_i = Vector(Midpoint[Segment[N, L]], N)
b_1 = Vector(Midpoint[Segment[N, L]], L)
CasillaDeEntrada1 = Textfield(n_1)
CasillaDeEntrada2 = Textfield(n_2)
k_1 = Segment(A, C)