碎形裡面的一個範例,給定一正三角形,取各邊中點,挖掉中間那塊正三角形(其邊界需留下),剩下三個相同的正三角形,接下來對剩下的每個三 角形做同樣的步驟,挖掉其各邊中點連線所成正三角形,重複此步驟無窮次。
Two-Dimensions
newpt[x_List]:={{x[[1]], Mean@{x[[1]], x[[2]]}, Mean@{x[[1]], x[[3]]}}, {x[[2]], Mean@{x[[2]], x[[1]]}, Mean@{x[[2]], x[[3]]}}, {x[[3]], Mean@{x[[3]], x[[1]]}, Mean@{x[[3]], x[[2]]}}};
pt={{0, 0}, {2, 0}, {1, Sqrt[3]}};
Stgraph[n_]:=Graphics[{Red, Polygon/@Nest[Flatten[Map[newpt, #], 1]&, {pt}, n]}]
Manipulate[Stgraph[i], {i, 1, 7, 1}]
Three-Dimensions
newpt[x_List]:={{x[[1]], Mean@{x[[1]], x[[2]]}, Mean@{x[[1]], x[[3]]}, Mean@{x[[1]], x[[4]]}}, {x[[2]], Mean@{x[[2]], x[[1]]}, Mean@{x[[2]], x[[3]]}, Mean@{x[[2]], x[[4]]}}, {x[[3]], Mean@{x[[3]], x[[1]]}, Mean@{x[[3]], x[[2]]}, Mean@{x[[3]], x[[4]]}}, {x[[4]], Mean@{x[[4]], x[[1]]}, Mean@{x[[4]], x[[2]]}, Mean@{x[[4]], x[[3]]}}};
pt={{0, 0, 0}, {2, 0, 0}, {1, Sqrt[3], 0}, {1, Sqrt[3]/3, 2Sqrt[2/3]}};
Graphics3D[{Red, Polygon/@Subsets[#, {3}]&/@Nest[Flatten[Map[newpt, #], 1]&, {pt}, 4]}, Boxed->False]
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~