Advertisement
Matthen

Circumcircles

Apr 10th, 2014
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. Clear[circle];
  2. circle[p1_, p2_, p3_] := circle[p1, p2, p3] = Module[{soln},
  3. soln =
  4. Quiet@Solve[
  5. Join[Map[(#[[1]] - a)^2 + (#[[2]] - b)^2 == r^2 &, {p1, p2,
  6. p3}], {r > 0}], {a, b, r}];
  7. ({a, b, r} /. soln[[1]])
  8. ];
  9. n = 30;
  10. ps = RandomReal[{-1, 1}, {n, 2}];
  11. frame[m_] :=
  12. Module[{triples},
  13. triples = Subsets[ps[[;; m]], {3}];
  14. Graphics[{
  15. Table[
  16. Block[{a, b, r},
  17. {a, b, r} = circle @@ triples[[i]];
  18. {Opacity[0.01 + 0.1 Tanh[0.5 r] + 2/m],
  19. ColorData["DarkRainbow"][Tanh[0.5 r]], Circle[{a, b}, r]}
  20. ]
  21. , {i, Length@triples}],
  22. {PointSize[Large], White, Point[ps[[;; m]]], Darker@Purple,
  23. PointSize[Medium], Point[ps[[;; m]]], Red, PointSize[Large],
  24. Point[ps[[m]]]}
  25. }, PlotRange -> 2]
  26. ]; frame[n];
  27. Manipulate[
  28. frame[m],
  29. {m,1,n,1}
  30. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement