0
$\begingroup$

I am looking to create a user interface where the user can click on the screen and create a picture or pattern using Koch's snowflakes. To do this, I was hoping to write the recursive function necessary to generate the Koch's snowflakes, then create graphics objects out of these snowflakes. Is it possible to create graphics objects like this? Any help will be much appreciated! Thanks!

$\endgroup$
4
  • 1
    $\begingroup$ Have you seen this, or searched for "Koch" on this site for other such threads? $\endgroup$ Commented Mar 19, 2017 at 0:46
  • $\begingroup$ I got a lot of useful links by entering "mathematica koch snowflake" in google. $\endgroup$ Commented Mar 19, 2017 at 4:00
  • $\begingroup$ On the user interface side of your question, it would help a lot if you were to give more details on how you want the user to interact with your snowflake drawing code. Mathematica has a function ClickPane that will give a simple user interface where you can draw a Koch snowflake each time the user clicks in the pane. You might start with that. For more complex user interaction, you might want use the Manipulate function. $\endgroup$ Commented Mar 19, 2017 at 4:07
  • $\begingroup$ What is the question? How to generate Koch snowflake, what parameters should it take? It rather sounds like a question about how to create a new primitive having the object, do you have it then?, if so then you can use 27184. Or maybe you the main question is the interactivity? Could you make a clear question and add what you have/have tried? $\endgroup$ Commented Mar 19, 2017 at 16:06

1 Answer 1

2
$\begingroup$

With 11.1 release you look into KochCurve. You can define all sorts of related fractal segment replacements. In case of snowflake you can define a function:

KochSnow[n_]:= 
With[
    {kc=KochCurve[n]},
    {kc,
    Rotate[kc,2Pi/3,{1/2,-(1/(2 Sqrt[3]))}],
    Rotate[kc,-2Pi/3,{1/2,-(1/(2 Sqrt[3]))}]}
]

Then you make:

Graphics[KochSnow[#]] & /@ Range[6]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.