{"id":1260,"date":"2021-09-29T13:11:08","date_gmt":"2021-09-29T17:11:08","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/?p=1260"},"modified":"2021-09-29T13:15:05","modified_gmt":"2021-09-29T17:15:05","slug":"lsh-blobfamily","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/lsh\/09\/29\/lsh-blobfamily\/","title":{"rendered":"lsh-BlobFamily"},"content":{"rendered":"<p>Continuing my practice of trying new tools for this course, I decided to try out the <a href=\"https:\/\/github.com\/thi-ng\/umbrella\/\">thing umbrella<\/a> for this project. The umbrella is a project by Karsten Schmidt in which he creates a giant package ecosystem full of every algorithm one could ever want. Thi.ng was originally written in Clojure, and the transform <em>definitely<\/em> feels like Clojure. For instance, I spent a long time fighting with the system until I realized certain functions fail unless passed empty lists as a final parameter. That being said, the library is wildly powerful! I was able to achieve amazing results with very little code. I would totally use the thingiverse again, though maybe when under a much longer deadline. I found myself thinking of <em>Good Shape<\/em> while I worked\u2014how it&#8217;s particularly difficult to describe what makes a shape &#8220;better.&#8221;<\/p>\n<p><a href=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-content\/uploads\/2021\/09\/gen.svg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-content\/uploads\/2021\/09\/gen.svg\" alt=\"\" width=\"640\" height=\"480\" class=\"alignnone size-medium wp-image-1264\" \/><\/a><\/p>\n<pre>\r\nimport { quad, asSvg, withAttribs, path } from '@thi.ng\/geom';\r\nimport { star } from '@thi.ng\/geom\/ctors\/polygon';\r\nimport { vertices } from '@thi.ng\/geom\/ops\/vertices';\r\nimport { scatter } from '@thi.ng\/geom\/ops\/scatter';\r\nimport { fuzzyPoly, compFill } from '@thi.ng\/geom-fuzz';\r\nimport { svg } from '@thi.ng\/hiccup-svg';\r\nimport { serialize } from '@thi.ng\/hiccup';\r\nimport { shuffle } from '@thi.ng\/arrays';\r\n\r\nconst width = 648;\r\nconst height = 864;\r\n\r\nconst buffer = 20;\r\nconst rad = 45;\r\n\r\nconst s = scatter(\r\n    quad(\r\n        [buffer + rad, buffer + rad],\r\n        [width - buffer - rad, height - buffer - rad],\r\n        [width - buffer - rad, height - buffer - rad],\r\n        [0, height - buffer - rad],\r\n    ),\r\n    17,\r\n);\r\n\r\nconst blobShapes = s.flatMap(([x, y], i) =&gt;\r\n    Array.from({ length: i % 2 ? 6 : 1 }, (_) =&gt;\r\n        star(\r\n            rad + buffer * Math.random(),\r\n            ~~(Math.random() * 5) + 3,\r\n            [1.0, 1.5],\r\n            {\r\n                fill: 'none',\r\n                stroke: 'black',\r\n                'stroke-width': '1px',\r\n                transform: `translate(${x},${y}) scale(${i \/ s.length})`,\r\n            },\r\n        ),\r\n    ),\r\n);\r\nconst blobs = blobShapes\r\n    .map((s) =&gt;\r\n        fuzzyPoly(vertices(s), s.attribs, { jitter: 5, curveScale: 0.5 }),\r\n    )\r\n    .map((b) =&gt; withAttribs(b.children.at(0), b.attribs));\r\n\r\nconst scene = asSvg(...blobs);\r\nconst output = serialize(svg({ width, height }, scene));\r\ndocument.querySelector('#app').innerHTML = `${output}`;\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Continuing my practice of trying new tools for this course, I decided to try out the thing umbrella for this project. The umbrella is a project by Karsten Schmidt in which he creates a giant package ecosystem full of every algorithm one could ever want. Thi.ng was originally written in Clojure, and the transform definitely &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/lsh\/09\/29\/lsh-blobfamily\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;lsh-BlobFamily&#8221;<\/span><\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts\/1260"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/comments?post=1260"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts\/1260\/revisions"}],"predecessor-version":[{"id":1272,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/posts\/1260\/revisions\/1272"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/media?parent=1260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/categories?post=1260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-428\/f2021\/wp-json\/wp\/v2\/tags?post=1260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}