Advertisement
Matthen

incircle pattern

Aug 16th, 2015
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. \[Theta]1[t_] := If[t < 1/3, 0, If[t < 2/3, (t - 1/3) Pi, Pi/3]];
  2. \[Theta]2[t_] := If[t < 2/3, 2 Pi /3, 2 Pi/3 + (t - 2/3) Pi];
  3. \[Theta]3[t_] := 4 Pi/3 + Pi If[t < 1/3, t, 1/3];
  4. ptsF[t_] := If[0 <= t < 1,
  5. pts = ({Sin[#], Cos[#]} &) /@ {\[Theta]1[t], \[Theta]2[
  6. t], \[Theta]3[t]},
  7. If[1 <= t < 2,
  8. pts = ({Sin[# + Pi + 4 Pi/3],
  9. Cos[# + Pi + 4 Pi/3]} &) /@ {\[Theta]3[t - 1], \[Theta]1[
  10. t - 1], \[Theta]2[t - 1]},
  11. If[2 <= t < 3,
  12. pts = ({Sin[# + 2 Pi/3], Cos[# + 2 Pi/3]} &) /@ {\[Theta]3[
  13. t - 2], \[Theta]1[t - 2], \[Theta]2[t - 2]},
  14. If[3 <= t < 4,
  15. pts = ({Sin[# + Pi + 0 Pi/3],
  16. Cos[# + Pi + 0 Pi/3]} &) /@ {\[Theta]3[t - 3], \[Theta]1[
  17. t - 3], \[Theta]2[t - 3]},
  18. If[4 <= t < 5,
  19. pts = ({Sin[# + 4 Pi/3], Cos[# + 4 Pi/3]} &) /@ {\[Theta]3[
  20. t - 4], \[Theta]1[t - 4], \[Theta]2[t - 4]},
  21. pts = ({Sin[# + Pi + 2 Pi/3],
  22. Cos[# + Pi + 2 Pi/3 ]} &) /@ {\[Theta]3[t - 5], \[Theta]1[
  23. t - 5], \[Theta]2[t - 5]}
  24. ]
  25. ]
  26. ]
  27. ]
  28. ];
  29. cr[t_] := Module[{pts, lengths, c, r},
  30. pts = ptsF[t];
  31. lengths = Norm /@ (pts - RotateRight[pts]);
  32. perimeter = Total[lengths];
  33. c = {(First /@ pts).RotateRight[lengths]/
  34. perimeter, (Last /@ pts).RotateRight[lengths]/perimeter};
  35. r = 0.5 Sqrt[
  36. Times @@ (lengths + RotateRight[lengths] - RotateLeft[lengths])/
  37. perimeter];
  38. {c, r}
  39. ];
  40. Manipulate[
  41. Module[{c, r, pts},
  42. pts = ptsF[Mod[t, 6, 0]];
  43. {c, r} = cr[Mod[t, 6, 0]];
  44. Show[
  45. Graphics[{
  46. {Darker@Red, Thick, Circle[{0, 0}, 1]},
  47. FaceForm[], EdgeForm[Black], Polygon[pts],
  48. PointSize[Medium],
  49. EdgeForm[Darker@Blue], FaceForm[RGBColor[0.7, 0.9, 1.0]],
  50. Disk[c, r],
  51. Darker@Red, Point[c], {Darker@Blue, Point[pts]},
  52. }, PlotRange -> 1, ImagePadding -> 10],
  53. ParametricPlot[
  54. cr[\[Tau]][[1]], {\[Tau], If[t < 6, 0, t - 6],
  55. If[t < 6, t, 6.001]}]
  56. ]
  57. ],
  58. {t, 0.001, 12}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement