{"id":1,"date":"2020-12-26T17:27:49","date_gmt":"2020-12-26T17:27:49","guid":{"rendered":"https:\/\/box5183\/cgi\/addon_GT.cgi?s=GT::WP::Install::EIG+%28tangowi2%29+-+10.24.48.83+%5BWordpress%3b+\/var\/hp\/common\/lib\/Wordpress.pm%3b+294%3b+Hosting::gap_call%5D\/?p=1"},"modified":"2021-10-02T20:45:35","modified_gmt":"2021-10-02T20:45:35","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/tangowithbear.blog\/?p=1","title":{"rendered":"LET IT SNOW"},"content":{"rendered":"\n<h1 class=\"has-text-align-left wp-block-heading\">Making a parametric snowflake with a help of Coch curve algorithm<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Tools:<\/strong> Rhinoceros, Grasshopper, Python<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"304\" src=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?resize=700%2C304&#038;ssl=1\" alt=\"\" class=\"wp-image-188\" srcset=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?resize=1024%2C444&amp;ssl=1 1024w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?resize=300%2C130&amp;ssl=1 300w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?resize=768%2C333&amp;ssl=1 768w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?resize=1536%2C666&amp;ssl=1 1536w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?w=1709&amp;ssl=1 1709w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/02\/snow-06.jpg?w=1400&amp;ssl=1 1400w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Winter is coming \u2026 I hope it will snow because snowflakes are awesome. Each of these \u201ctiny miracles of nature\u201d has a unique pattern. To generate this pattern in grasshopper let&#8217;s first take a look at the way it is made.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Morphology<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Before designing an element of a particular form it is necessary to understand a process that leads to such form. A snowflake is an ice crystal made from water molecules. A  molecule H2O has two light hydrogen atoms attached to one heavier oxygen atom. Electric forces between the atoms forces the molecules fit together in hexagons. This interaction is known as hydrogen bonding.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><iframe loading=\"lazy\" title=\"The science of snowflakes - Maru\u0161a Brada\u010d\" width=\"700\" height=\"394\" src=\"https:\/\/www.youtube.com\/embed\/FwGH4gulLX4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A snowflake starts as a flat hexagon and as new molecules stick to it the lattice grows into a six-pointed crystal. In this crystal structure, there are sixth-order symmetry axes. By the way, these are not simple sixth-order axes, but helical ones, which are a combination of 60 \u00b0 rotation with partial translation along the axis. Because of it&#8217;s molecule structure a snowflake can have the infinite number of variations, which however all are defined by specific patterns of growth (The Wegener\u2013Bergeron\u2013Findeisen process)<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p class=\"has-drop-cap has-text-align-left has-white-color has-black-background-color has-text-color has-background wp-block-paragraph\" style=\"font-size:18px\">Interesting fact :   <strong>Wilson Bentley<\/strong>  is believed to be the first person to take a detailed photo of a snowflake by  attaching a camera to his microscope. Bentley donated his collection  to the&nbsp;Buffalo Museum of Science. <a href=\"https:\/\/snowflakebentley.com\/\">https:\/\/snowflakebentley.com\/<\/a> <\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-jetpack-tiled-gallery aligncenter is-style-square\"><div class=\"tiled-gallery__gallery\"><div class=\"tiled-gallery__row columns-2\"><div class=\"tiled-gallery__col\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/8aa4922f-902d-4c58-81e6-6b5313af0478-20171207SnowflakeBentley7.jpg?resize=600%2C600&#038;strip=info&#038;ssl=1 600w,https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/8aa4922f-902d-4c58-81e6-6b5313af0478-20171207SnowflakeBentley7.jpg?resize=640%2C640&#038;strip=info&#038;ssl=1 640w\" alt=\"\" data-height=\"704\" data-id=\"168\" data-link=\"https:\/\/tangowithbear.blog\/?attachment_id=168\" data-url=\"https:\/\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/8aa4922f-902d-4c58-81e6-6b5313af0478-20171207SnowflakeBentley7.jpg\" data-width=\"640\" src=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/8aa4922f-902d-4c58-81e6-6b5313af0478-20171207SnowflakeBentley7.jpg?ssl=1&amp;resize=640%2C640\" layout=\"responsive\"\/><\/figure><\/div><div class=\"tiled-gallery__col\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" srcset=\"https:\/\/i1.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/30e9f68f7c227f368322e45ef90f1e29.jpg?resize=363%2C363&#038;strip=info&#038;ssl=1 363w\" alt=\"\" data-height=\"401\" data-id=\"166\" data-link=\"https:\/\/tangowithbear.blog\/?attachment_id=166\" data-url=\"https:\/\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/30e9f68f7c227f368322e45ef90f1e29.jpg\" data-width=\"363\" src=\"https:\/\/i1.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/30e9f68f7c227f368322e45ef90f1e29.jpg?ssl=1&amp;resize=363%2C363\" layout=\"responsive\"\/><\/figure><\/div><\/div><\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">What is important:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Six-fold radial symmetry. (The number of rays is fixed to six)<\/li><li>Hexagonal lattice<\/li><li>Fractal growth.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The idea is to design a pattern on one side of the ray, then mirror it and repeat 5 more times. I will use the Koch Curve as the pattern. Since the fractal growth is defined by recursive algorithm the python component seems unavoidable. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s start with a Koch Curve:<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h5 class=\"wp-block-heading\">Step 1.  Define the vertices between the EndPoints<\/h5>\n\n\n\n<p class=\"has-text-align-left wp-block-paragraph\">Remember the points are vectors here. The type hint should be a Vector 3D.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"764\" style=\"aspect-ratio: 1696 \/ 764;\" width=\"1696\" autoplay controls loop src=\"https:\/\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/Step1.mp4\" playsinline><\/video><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 2. Create a recursion, connect the points with lines.<\/h5>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"764\" style=\"aspect-ratio: 1696 \/ 764;\" width=\"1696\" autoplay controls loop src=\"https:\/\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/STEP22.mp4\" playsinline><\/video><\/figure>\n<\/div><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">3. Create a mirror copy.<\/h5>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"764\" style=\"aspect-ratio: 1696 \/ 764;\" width=\"1696\" autoplay controls loop src=\"https:\/\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/Step-3.mp4\" playsinline><\/video><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">4. Rotate with copies.<\/h5>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-image center\"><figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2021\/01\/snowflake.gif?resize=700%2C650&#038;ssl=1\" alt=\"\" class=\"wp-image-130\" width=\"700\" height=\"650\"\/><\/figure><\/div>\n<\/div><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">5. Enjoy<\/h5>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?w=700&#038;ssl=1\" alt=\"\" class=\"wp-image-292\"  srcset=\"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?resize=1024%2C445&amp;ssl=1 1024w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?resize=300%2C130&amp;ssl=1 300w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?resize=768%2C333&amp;ssl=1 768w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?resize=1536%2C667&amp;ssl=1 1536w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?w=1700&amp;ssl=1 1700w, https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-011.jpg?w=1400&amp;ssl=1 1400w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You might notice that there is no hexagonal grid in geometry. Also it doesn&#8217;t really &#8220;grow&#8221; in terms of size. So there is still plenty of room for improvement&#8230;  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will find below the code I used for the python component. It was inspired by Jose Sanchez youtube tutorial: <a href=\"https:\/\/www.youtube.com\/watch?v=iWfepR9gKDg\" data-type=\"URL\" data-id=\"https:\/\/www.youtube.com\/watch?v=iWfepR9gKDg\">https:\/\/www.youtube.com\/watch?v=iWfepR9gKDg<\/a> :  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You might need some linear algebra basics (from school) to understand the vectors.<\/p>\n\n\n\n<pre class=\"wp-block-code center\"><code lang=\"python\" class=\"language-python\">\nimport rhinoscriptsyntax as rs\nimport Rhino.Geometry as rg\n\ncenterpt = pt1\n\ndef koch(pt1,pt2):\n    \"\"\"Define the Koch curve vertices between the End points (pt1, pt2).\"\"\"\n    \n    p1 = (pt2 - pt1) * dist1 + pt1\n    p2 = (pt2 - pt1) * dist2 + pt1\n    p3 = (pt2 - pt1) * dist3 + pt1\n    \n    v1 = (pt2 - pt1)\n    w = rg.Vector3d(-v1.Y, v1.X, 0)\n    v = dist4 * w + p2\n    \n    return [pt1, p1,v,p3, pt2]\n\ndef rec(pt1,pt2, gens, lineList):\n    \"\"\"Create a recursion. Connect the points with lines in order.\"\"\"\n    \n    if(gens &gt; 0):\n        \n        newPts = koch(pt1, pt2)\n        line = rs.AddPolyline([newPts[0],newPts[1],newPts[2],newPts[3],newPts[4]])\n        if(gens == 1):\n            lineList.append(line)\n            \n        rec(newPts[0],newPts[1], gens-1, lineList)\n        rec(newPts[1],newPts[2], gens-1, lineList)\n        rec(newPts[2],newPts[3], gens-1, lineList)\n        rec(newPts[3],newPts[4], gens-1, lineList)\n        return lineList\n        \nallLines = []\n\na = rec(pt1, pt2, gens, allLines)\n\n\"\"\"Create a mirror copy. Put all geometry in a list\"\"\"\npt3 = rg.Point3d(pt2.X, pt2.Y, pt2.Z+1)\nplanePts = [pt1, pt2, pt3]\nplane = rs.PlaneFitFromPoints(planePts)\nxform = rg.Transform.Mirror(plane)\nmir = rs.TransformObjects(allLines, xform, copy=True)\n\nobj = a+mir\nraylst = [obj]\n\n\"\"\"Make 5 rotate copies. Put it in a list\"\"\"\nfor i in range(5):\n    ray = rs.RotateObjects(obj, centerpt, 60, copy=True)\n    obj = ray\n    raylst.append(ray)\n\n\n\"\"\"Flatten the list\"\"\"\nsnowflake =[]\n\nfor row in raylst:\n    for elem in row:\n        snowflake.append(elem)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Making a parametric snowflake with a help of Coch curve algorithm<\/p>\n","protected":false},"author":1,"featured_media":182,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-uncategorized","post_format-post-format-image"],"acf":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/tangowithbear.blog\/wp-content\/uploads\/2020\/12\/snow-01.jpg?fit=1247%2C734&ssl=1","_links":{"self":[{"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":4,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":431,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/431"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=\/wp\/v2\/media\/182"}],"wp:attachment":[{"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tangowithbear.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}