{"id":5756,"date":"2014-12-26T09:00:23","date_gmt":"2014-12-26T14:00:23","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=5756"},"modified":"2014-12-24T13:48:36","modified_gmt":"2014-12-24T18:48:36","slug":"koch-curve","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2014\/12\/26\/koch-curve\/","title":{"rendered":"Koch Curve"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <h1>Koch Curve<\/h1>\r\n   <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/29096\">Idin<\/a>'s pick for this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/44917-koch-curve\">Koch curve<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/418342\">Dimitrios Piretzidis<\/a>.\r\n   <\/p>\r\n   <p>This week being a holiday week in the US, and start of winter in the Northern Hemisphere where our corner of the world (Natick,\r\n      Massachusetts) is located, I figured I would pick something a little more fun and winter related, like a snowflake!\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainidin3\/snowflake.png\"> <\/p>\r\n   <p>The &#8220;Koch Snowflake&#8221; or &#8220;Koch Star&#8221; is a well-known <a href=\"http:\/\/en.wikipedia.org\/wiki\/Fractal\">fractal<\/a> curve (actually one of the earliest fractals to be described). There are many places on the web where you can read about\r\n      the Koch Snowflake:\r\n   <\/p>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"https:\/\/www.khanacademy.org\/math\/geometry\/basic-geometry\/koch_snowflake\/v\/koch-snowflake-fractal\">https:\/\/www.khanacademy.org\/math\/geometry\/basic-geometry\/koch_snowflake\/v\/koch-snowflake-fractal<\/a><\/li>\r\n         <li><a href=\"http:\/\/mathworld.wolfram.com\/KochSnowflake.html\">http:\/\/mathworld.wolfram.com\/KochSnowflake.html<\/a><\/li>\r\n         <li><a href=\"http:\/\/en.wikipedia.org\/wiki\/Koch_snowflake\">http:\/\/en.wikipedia.org\/wiki\/Koch_snowflake<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <p>The mathematical formula for the Koch snowflake isn't very complicated, and there are at least a half-dozen Koch-related submissions\r\n      I found on File Exchange. I picked this particular one out of the bunch because it worked straight out of the box, and it\r\n      has a simple user interface that makes generating a snowflake as easy as entering an integer and pressing a button! Be warned,\r\n      though, for any iteration order above 6 or 7, it will take a while to generate your snowflake! A close runner-up for me was\r\n      this submission:\r\n   <\/p>\r\n   <p><a title=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/27577-fractal-curves (link no longer works)\">https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/27577-fractal-curves<\/a><\/p>\r\n   <p>This gives you more fractal functions, and the code is perhaps a bit more polished, but it's not as easy as a graphical user\r\n      interface with a push button!\r\n   <\/p>\r\n   <p>Happy winter, everyone!<\/p>\r\n   <p>As always, your thoughts and <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=5756#respond\">comments here<\/a> are greatly appreciated.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_4182bcd5fc0e4f028adb9dcab90fff88() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='4182bcd5fc0e4f028adb9dcab90fff88 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 4182bcd5fc0e4f028adb9dcab90fff88';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Idin Motedayen-Aval';\r\n        copyright = 'Copyright 2014 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_4182bcd5fc0e4f028adb9dcab90fff88()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2015a<br><\/p>\r\n<\/div>\r\n<!--\r\n4182bcd5fc0e4f028adb9dcab90fff88 ##### SOURCE BEGIN #####\r\n%% Koch Curve\r\n%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/29096\r\n% Idin>'s pick for this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/44917-koch-curve Koch curve> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/418342\r\n% Dimitrios Piretzidis>.  \r\n%\r\n% This week being a holiday week in the US, and\r\n% start of winter in the Northern Hemisphere where our corner of the world\r\n% (Natick, Massachusetts) is located, I figured I would pick something a\r\n% little more fun and winter related, like a snowflake!\r\n%\r\n% <<snowflake.png>> \r\n%\r\n% The \u00e2\u20ac\u0153Koch Snowflake\u00e2\u20ac\ufffd or \u00e2\u20ac\u0153Koch Star\u00e2\u20ac\ufffd is a well-known\r\n% <http:\/\/en.wikipedia.org\/wiki\/Fractal fractal> curve (actually one of the\r\n% earliest fractals to be described). There are many places on the web\r\n% where you can read about the Koch Snowflake:\r\n%\r\n% * <https:\/\/www.khanacademy.org\/math\/geometry\/basic-geometry\/koch_snowflake\/v\/koch-snowflake-fractal>\r\n% * <http:\/\/mathworld.wolfram.com\/KochSnowflake.html>\r\n% * <http:\/\/en.wikipedia.org\/wiki\/Koch_snowflake>\r\n%\r\n% The mathematical formula for the Koch snowflake isn't very complicated,\r\n% and there are at least a half-dozen Koch-related submissions I found on\r\n% File Exchange. I picked this particular one out of the bunch because it\r\n% worked straight out of the box, and it has a simple user interface that\r\n% makes generating a snowflake as easy as entering an integer and pressing\r\n% a button! Be warned, though, for any iteration order above 6 or 7, it\r\n% will take a while to generate your snowflake! A close runner-up for me\r\n% was this submission:\r\n%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/27577-fractal-curves>\r\n%\r\n% This gives you more fractal functions, and the code is perhaps a bit more\r\n% polished, but it's not as easy as a graphical user interface with a push\r\n% button!\r\n%\r\n% Happy winter, everyone!\r\n%\r\n%\r\n% As always, your thoughts and\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=5756#respond comments here> are\r\n% greatly appreciated.\r\n\r\n\r\n \r\n\r\n##### SOURCE END ##### 4182bcd5fc0e4f028adb9dcab90fff88\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainidin3\/snowflake.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n   Koch Curve\r\n   Idin's pick for this week is Koch curve by Dimitrios Piretzidis.\r\n   \r\n   This week being a holiday week in the US, and start of winter in the Northern Hemisphere where our corner... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2014\/12\/26\/koch-curve\/\">read more >><\/a><\/p>","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5756"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=5756"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5756\/revisions"}],"predecessor-version":[{"id":5757,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5756\/revisions\/5757"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=5756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=5756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=5756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}