{"id":414,"date":"2021-08-08T18:06:19","date_gmt":"2021-08-08T18:06:19","guid":{"rendered":"http:\/\/summergeometry.org\/sgi2021\/?p=414"},"modified":"2021-08-09T13:49:43","modified_gmt":"2021-08-09T13:49:43","slug":"puzzle-ed","status":"publish","type":"post","link":"https:\/\/summergeometry.org\/sgi2021\/puzzle-ed\/","title":{"rendered":"Puzzle-ed"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The SGI research program has been structured in a novel way in which each project lasts for one or two weeks only. This gives Fellows the opportunity to work with multiple mentors and in different areas of Geometry Processing. A lot of SGI fellows, including me, had wondered how we would be able to finish the projects in such a short period of time. After two weeks, as I pause my first research project at SGI, I am reminded of Professor Solomon&#8217;s remark that a surprising amount of work can be done within 1\/2 weeks when guided by an expert mentor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this post, I have shared the work I have done under the mentorship of Prof. <a href=\"http:\/\/diwlevin.com\/\">David Levin<\/a> over the last two weeks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Optimal Interlocking Parts via Implicit Shape Optimizations<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this project, we explored how to automatically design jigsaw puzzles such that all puzzle pieces are as close to a given input shape \\(I\\) as possible, while still satisfying the requirement of interlocking.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Lloyd relaxation with Shape Matching metric<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">As the first step, we needed a rough division of the domain into regions corresponding to puzzle pieces. For this initial division we used Lloyd\u2019s relaxation as it ensured that the pieces would interlock. To create regions similar to the input shape, we employed a new distance metric. This metric is based on shape matching.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Shape Matching metric:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The input shape  \\(I\\)  is represented as a collection of points \\(V\\)  on its boundary and is assumed to be of unit size and centered at the origin. Consider a pixel \\(p\\) and a site \\(x\\). First the input shape is translated to  \\(x\\)  ( \\(V \\rightarrow V&#8217;\\)). The value of scaling factor \\(s\\) that minimizes the distance between \\(p\\) and the closest point \\(V&#8217;_i\\) on the boundary of the input shape gives us the shape matching metric. \\[s^* = \\text{arg min}  \\frac {1} {2}(dist(p, sV\u2019))\\]<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"118\" height=\"115\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/Lloyd_square_crop-1.png\" alt=\"\" data-id=\"437\" data-link=\"http:\/\/summergeometry.org\/sgi2021\/?attachment_id=437\" class=\"wp-image-437\"\/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"118\" height=\"116\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/Lloyd_puzzle_crop-2.png\" alt=\"\" data-id=\"438\" data-link=\"http:\/\/summergeometry.org\/sgi2021\/?attachment_id=438\" class=\"wp-image-438\"\/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\">Results of Lloyd\u2019s relaxation with shape matching in a 16X16 domain for Input Shapes: Square and a Puzzle piece respectively.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Pre computing maps<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The straightforward implementation for Lloyd\u2019s relaxation that I had been using was iterative and therefore very slow. In fact, testing the algorithm for larger domains or complicated shapes that needed dense sampling of boundary points was infeasible. Therefore, optimizing the algorithm was an immediate requirement. I realized that relative to the site \\(x\\), the distances would vary around it in exactly the same way. So, computing the distance between each pixel and each site separately during each iteration of Lloyd\u2019s relaxation was redundant and could be avoided by pre-computing a distance map for the given object before starting Lloyd\u2019s relaxation.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-2 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"315\" height=\"314\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/square_100_map_crop.png\" alt=\"\" data-id=\"446\" data-full-url=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/square_100_map_crop.png\" data-link=\"http:\/\/summergeometry.org\/sgi2021\/?attachment_id=446\" class=\"wp-image-446\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/square_100_map_crop.png 315w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/square_100_map_crop-300x300.png 300w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/square_100_map_crop-150x150.png 150w\" sizes=\"auto, (max-width: 315px) 100vw, 315px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"465\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-1-1.png\" alt=\"\" data-id=\"447\" data-full-url=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-1-1.png\" data-link=\"http:\/\/summergeometry.org\/sgi2021\/?attachment_id=447\" class=\"wp-image-447\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-1-1.png 465w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-1-1-300x300.png 300w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-1-1-150x150.png 150w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\">200&#215;200 maps for square input shape and puzzle piece. The input shape has been scaled and overlaid on top of the map for clarity. <\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Enhancing the shape matching metric<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to speeding up the algorithm, the distance maps also helped in determining the next step. As can be seen from the figures above, the maps weren\u2019t smooth. These jumps in distance fields occurred because the shape matching metric worked on a set of discrete points. Optimizing the scaling factor for minimizing distance to the closest edge instead of closest point resolved this.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"431\" height=\"425\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/puzzle_100_map_.png\" alt=\"\" class=\"wp-image-449\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/puzzle_100_map_.png 431w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/puzzle_100_map_-300x296.png 300w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><figcaption> 200&#215;200 Map with enhanced Shape Matching metric input shape of a puzzle piece.<\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Shaping the puzzle pieces (In progress)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The initial regions are obtained from Lloyd\u2019s algorithm with the shape matching metric need to be refined so that the final puzzle pieces are highly similar to the input shape \\(I\\).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am currently exploring the use of point set registration methods to find the best transformations on the input shape so that it fits the initial regions. These transformations could then be used to inform the next iteration of Lloyd\u2019s algorithm to refine the regions. This process can be repeated until the region stops changing, giving us our final puzzle pieces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have thoroughly enjoyed working on this project, and I am looking forward to the next project I would be working on!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The SGI research program has been structured in a novel way in which each project lasts for one or two weeks only. This gives Fellows the opportunity to work with multiple mentors and in different areas of Geometry Processing. A lot of SGI fellows, including me, had wondered how we would be able to finish [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,25],"tags":[36],"class_list":["post-414","post","type-post","status-publish","format-standard","hentry","category-demo","category-sgi-research-projects","tag-computational-fabrication"],"_links":{"self":[{"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts\/414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/comments?post=414"}],"version-history":[{"count":9,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts\/414\/revisions"}],"predecessor-version":[{"id":483,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts\/414\/revisions\/483"}],"wp:attachment":[{"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/media?parent=414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/categories?post=414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/tags?post=414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}