Created
December 16, 2015 13:06
-
-
Save butchi/5dc9a5352744dc65bf34 to your computer and use it in GitHub Desktop.
コッホ曲線(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/0e1c015f8c3d6955c88b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| generator = {0, Pi/3, -Pi/3, 0}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f[list_] := list + # & /@ generator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| {0, Pi/3, -Pi/3, 0} + 0, | |
| {0, Pi/3, -Pi/3, 0} + Pi/3, | |
| {0, Pi/3, -Pi/3, 0} + -Pi/3, | |
| {0, Pi/3, -Pi/3, 0} + 0 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inclinationList = Flatten[Nest[f, generator, 5]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cPoints = Join[{0}, Accumulate[E^(I inclinationList)]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Graphics[Line[Transpose[{Re[cPoints], Im[cPoints]}]]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| generator = {0, Pi/3, -Pi/3, 0}; | |
| f[list_] := list + # & /@ generator | |
| inclinationList = Flatten[Nest[f, generator, 5]]; | |
| cPoints = Join[{0}, Accumulate[E^(I inclinationList)]]; | |
| Graphics[Line[Transpose[{Re[cPoints], Im[cPoints]}]]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Graphics@Line@Transpose@{Re[#],Im[#]}&@FoldList[Plus,0,E^(Flatten@Nest[Function[l,l+#&/@{0,Pi/3,-Pi/3,0}],{0},5]I)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment