Deslízame

r

r = 4 (slider from 1 to 6, step 0.1)
n = 60 (slider from 4 to 120, step 4)
d = 0 (slider from 0 to 3, step 0.01)
t1 = If(d < 1.0, d, 1.0)
t2 = If(d > 1.0, If[d > 2.0, 1.0, d - 1.0], 0.0)
O = (4, 0)
c = Circle(O, r)
A = Point(c)
a = Tangent(A, c)
α = If(y(A) ≥ 0.0, atan(Slope[a]), atan(Slope[a]) + 3.141592653589793)
A' = Mirror(A, O)
A'' = Rotate(A', 2.0 * 3.141592653589793 / n, O)
b = Segment(A', A'')
Lcos = Sequence(cos(α + (2.0 * s - 1.0) * (1.0 - t1) * 3.141592653589793 / n), s, 1.0, n / 4.0)
Lsen = Sequence(sin(α + (2.0 * s - 1.0) * (1.0 - t1) * 3.141592653589793 / n), s, 1.0, n / 4.0)
SumCos = Sequence(Sum[Lcos, s], s, 1.0, n / 4.0)
SumSen = Sequence(Sum[Lsen, s], s, 1.0, n / 4.0)
L1a = Sequence(A' + b * (Element[SumCos, s], Element[SumSen, s]), s, 1.0, n / 4.0)
L1b = Sequence(Mirror[Element[L1a, s], Line[A, A']], s, 1.0, n / 4.0)
L1c = Join({Reverse[L1b], {A'}, L1a})
B = Rotate(Element[L1a, 1.0], 3.141592653589793 / 2.0 - 3.141592653589793 / n, A')
C: A' + r * UnitVector[Vector[A', B]]
D = Mirror(C, Line[A, A'])
L2 = Join({{B}, Sequence[Rotate[Element[L1a, s + 1.0], 3.141592653589793 / 2.0 - 3.141592653589793 / n, Element[L1a, s]], s, 1.0, n / 4.0 - 1.0]})
L3a = Sequence(Element[L1a, s] + r * UnitVector[Vector[Element[L1a, s], Element[L2, s + 1.0]]], s, 1.0, n / 4.0 - 1.0)
L3b = Sequence(Mirror[Element[L3a, s], Line[A, A']], s, 1.0, n / 4.0 - 1.0)
L3c = Join({Reverse[L3b], {D}, {C}, L3a})
E = Rotate(A' + b * (cos(α + (1.0 - t1) * 3.141592653589793 / n), sin(α + (1.0 - t1) * 3.141592653589793 / n)), 3.141592653589793 / 2.0 - 3.141592653589793 / n, A')
F: A' + r * UnitVector[Vector[A', E]]
u = Vector(A, F)
L4 = Sequence(t2 * u + Mirror[Element[L1c, s], O], s, 1.0, n / 2.0 + 1.0)
L5a = Sequence(Mirror[Element[L3c, s], O], s, 1.0, n / 2.0)
L5b = Sequence(Element[L5a, s] + t2 * u, s, 1.0, n / 2.0)
L6a = Sequence(Polygon[Element[L1c, s], Element[L1c, s + 1.0], Element[L3c, s]], s, 1.0, n / 2.0 + 1.0)
L6b = Sequence(Polygon[Element[L4, s], Element[L4, s + 1.0], Element[L5b, s]], s, 1.0, n / 2.0 + 1.0)
G: F - UnitVector[u] / 2.0
H: Element[L4, 1.0] - UnitVector[u] / 2.0
t3 = If(d > 2.0, d - 2.0, 0.0)
I: G + t3 * Vector[G, H]
v1 = Vector(G, I)
w1 = Vector(G, G - v1)
texto1 = If(n > 36.0, "≅ π r", "semiperímetro")
K: Element[L1a, n / 4.0] + UnitVector[v1] / 2.0
J: Element[L4, 1.0] + UnitVector[v1] / 2.0
L: (J + K) / 2.0
M: L + t3 * Vector[L, K]
v2 = Vector(L, M)
w2 = Vector(L, L - v2)
texto3: "Semiperímetro = " + (b * n / 2.0)
texto4: "Semicircunferencia = π r = " + (3.141592653589793 * r)