Advertisement
Matthen

Dudeney's hinged dissection

Sep 9th, 2013
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. inverse[s_, s3_, x_] := Module[{s4},
  2. s4 = Map[Join[#, {1}] &, s3];
  3. Map[#[x[[1]], x[[2]], 1] &, ({LinearModelFit[{s4, First /@ s}],
  4. LinearModelFit[{s4, Last /@ s}]})]
  5. ];
  6. Dudeney[t_, T_] :=
  7. Module[{a, b, c, n, m, x, l, k, h, p, q, r, s, angle, q1, r1, s1, m1,
  8. l1, m2, q2, r2, s2, l2, l3, m3, p3, q3, r3, s3, p1, p2,
  9. M},(*The vertices of an equilateral triangle are:*){a, b, c} =
  10. Map[RotationMatrix[# 2 N[Pi]/3].{0, 1} &, {0, 1, 2}];
  11. (*The midpoints of ab and ac are*)n = (a + b)/2;
  12. m = (a + c)/2;
  13. (*The quarter and three-quarter points of bc are*)
  14. x = b + (c - b)/4;
  15. l = b + 3 (c - b)/4;
  16. (*From n,draw a perpendicular to meet mx at k,
  17. and from l draw another one to meet mx at h.*)
  18. k = Projection[n - x, m - x] + x;
  19. h = Projection[l - x, m - x] + x;
  20. (*At time zero,
  21. the original triangle abc is cut up into three quadrilaterals,p,q,
  22. and r and and a small triangle,s.*)p = {b, n, k, x};
  23. q = {a, n, k, m};
  24. r = {c, m, h, l};
  25. s = {x, l, h};
  26. (*The pieces q,
  27. r and s are rotated about moving hinges which were originally at n,
  28. m,and l.*)
  29.  
  30.  
  31. If[T <= 0.25,
  32. angle = N[Pi] (t - 1)/(T - 1);
  33. ,
  34. angle = N[Pi] (t - 1)/((0.5 - T) - 1);
  35.  
  36. ];
  37. q1 = Map[n + RotationMatrix[angle].(# - n) &, q];
  38. r1 = Map[n + RotationMatrix[angle].(# - n) &, r];
  39. s1 = Map[n + RotationMatrix[angle].(# - n) &, s];
  40.  
  41. {m1, l1} = Map[n + RotationMatrix[angle].(# - n) &, {m, l}];
  42. r2 = Map[m1 + RotationMatrix[angle].(# - m1) &, r1];
  43. s2 = Map[m1 + RotationMatrix[angle].(# - m1) &, s1];
  44. l2 = m1 + RotationMatrix[angle].(l1 - m1);
  45. s3 = Map[l2 + RotationMatrix[angle].(# - l2) &, s2];
  46.  
  47. If[T > 0.25,
  48. p = Map[inverse[s, s3, #] &, p];
  49. q1 = Map[inverse[s, s3, #] &, q1];
  50. r2 = Map[inverse[s, s3, #] &, r2];
  51. s3 = Map[inverse[s, s3, #] &, s3];
  52.  
  53. ];
  54.  
  55. Graphics[{EdgeForm[Black], RGBColor[0.7, 0.2, 0.6], Polygon@p,
  56. RGBColor[0.7, 0.6, 0.8], Polygon@q1, RGBColor[.9, .71, .26],
  57. Polygon@r2, RGBColor[0, 0.7, 0.5], Polygon@s3
  58. }, PlotRange -> {{-3, 3}, {-3, 3}}, AspectRatio -> Automatic,
  59. Axes -> None, ImageSize -> {450, 450}]];
  60. f[t_] := (Tanh[20 (t - 0.125)] + 1)/8 + (Tanh[20 (t - 0.325)] + 1)/8;
  61. Plot[f[t], {t, 0, 0.5}, PlotRange -> {-0.1, 0.5}];
  62. Manipulate[Dudeney[4, f[t]], {t, 0, 0.5}, SaveDefinitions -> True]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement