{"id":818,"date":"2021-08-25T02:50:11","date_gmt":"2021-08-25T02:50:11","guid":{"rendered":"http:\/\/summergeometry.org\/sgi2021\/?p=818"},"modified":"2021-08-25T02:50:37","modified_gmt":"2021-08-25T02:50:37","slug":"branch-and-bound-method-for-calculating-hausdorff-distance","status":"publish","type":"post","link":"https:\/\/summergeometry.org\/sgi2021\/branch-and-bound-method-for-calculating-hausdorff-distance\/","title":{"rendered":"Branch-and-bound method for calculating Hausdorff distance"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This week I worked on the \u201cRobust computation of the Hausdorff distance between triangle meshes\u201d project with our mentor Dr. Leonardo Sacht, TA Erik Amezquita and my team Talant Talipov and Bryce Van Ross.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We started our project by doing some initial reading about the topic. Hausdorff distance from triangle meshes <em>A<\/em> to <em>B<\/em> is defined as $$h(A,B) = \\max_{p \\in A}d(p,B)$$ where <em>d<\/em> is the Euclidean norm. Finding the Hausdorff distance between two triangle meshes is one way of comparing these meshes. We note that the Hausdorff distance from <em>A<\/em> to <em>B<\/em> might be different from the Hausdorff distance from <em><em>B<\/em><\/em> to <em>A<\/em>, as you can see in the figure below, so it is important to distinguish which one is being computed. <\/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<div class=\"wp-block-group alignfull\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost3.png\" alt=\"\" class=\"wp-image-889\" width=\"357\" height=\"232\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost3.png 930w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost3-300x195.png 300w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost3-768x499.png 768w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><figcaption>Figure 1: Hausdorff distance from Mesh A to Mesh B<\/figcaption><\/figure><\/div>\n<\/div><\/div>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost4.png\" alt=\"\" class=\"wp-image-890\" width=\"363\" height=\"228\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost4.png 974w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost4-300x189.png 300w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/blogpost4-768x483.png 768w\" sizes=\"auto, (max-width: 363px) 100vw, 363px\" \/><figcaption>Figure 2: Hausdorff distance from Mesh B to Mesh A<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Finally we define $$H(a,b) = \\max{h(A,B), h(B,A)}$$ and use this value that is symmetric when comparing triangle meshes <em>A<\/em> and <em>B<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our first task was to implement Branch and Bound methods for calculating this distance. Suppose we want to calculate the Hausdorff distance from mesh <em>A<\/em> to mesh <em>B<\/em>. There were three main steps in the algorithm to do this: calculation of the upper and lower bound for the Hausdorff distance, and discarding and subdividing triangles according to the values of the upper and lower bound.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The upper bound for each triangle in <em>A<\/em> is calculated by taking the maximum of the distances from the given triangle to every vertex in <em>B<\/em>.&nbsp; The lower bound is calculated over <em>A<\/em> by taking the minimum of the distances from each vertex <em>p<\/em> in A to the triangle in <em>B<\/em> that is closest to <em>p<\/em>. If a triangle in <em>A<\/em> has an upper bound that is less than the lower bound, the triangle is discarded. After the discarding process, the remaining triangles are subdivided into four triangles and the process is repeated with recalculation of the upper bounds and the lower bound. The algorithm is run until the values for the upper and lower bound are within some <em>\u03b5<\/em> of each other. Ultimately, we get a triangle region that contains the point that realizes the Hausdorff distance from <em>A<\/em> to <em>B<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To implement this method, my teammates tackled the upper and lower bound codes while I wrote an algorithm for the discarding and subdividing process:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/tT-8Hv0qiuKb1CI__xnFnbK5XwI_QYalHVCkvhH6gGwR2VJpvfcW8vI4X0sqm5QI_-PNoNHUq7f20uzGg2VRJxgjtstfEl49-fPwgQgBqoupQtEi7EGt1PolXl-0pYke_14KoQB3\" alt=\"\" width=\"406\" height=\"215\"\/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/Ble3pvMcrdWh92afxwhRk903JJLYPmY6K2L9p_MFxvgyIoetiuVuChdwzPi9HwLX0U--Z6a-3_z_IGufZ5AsNnWzZsWpLHutF_aTbvjLuvtd_8NjhDxCf-_1YzOd4JmoyYZXJbol\" alt=\"\" width=\"433\" height=\"391\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">We ran this algorithm with testing values <em>u = [1;2;3;4;5]<\/em> and <em>l = 3 <\/em>and got these results:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-8-1024x768.png\" alt=\"\" class=\"wp-image-887\" width=\"369\" height=\"276\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-8-1024x768.png 1024w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-8-300x225.png 300w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-8-768x576.png 768w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-8.png 1120w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><figcaption>Figure 3: Initial mesh<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-7-1024x768.png\" alt=\"\" class=\"wp-image-886\" width=\"406\" height=\"304\" srcset=\"https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-7-1024x768.png 1024w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-7-300x225.png 300w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-7-768x576.png 768w, https:\/\/summergeometry.org\/sgi2021\/wp-content\/uploads\/2021\/08\/image-7.png 1120w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><figcaption>Figure 4: After discarding and subdividing<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As expected, the two triangles that had the upper bound of 1 and 2 were discarded and the rest were subdivided.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0The lower bound algorithm turned out to be more challenging than we anticipated, and we worked together to come up with a robust method. Currently, we are working on finishing up this part of the code, so that we can run and test the whole algorithm. After this, we are looking forward to extending this project in different directions, whether it is a more theoretical analysis of the topic or working on improving our algorithm!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I worked on the \u201cRobust computation of the Hausdorff distance between triangle meshes\u201d project with our mentor Dr. Leonardo Sacht, TA Erik Amezquita and my team Talant Talipov and Bryce Van Ross. We started our project by doing some initial reading about the topic. Hausdorff distance from triangle meshes A to B is [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[81],"class_list":["post-818","post","type-post","status-publish","format-standard","hentry","category-sgi-research-projects","tag-hausdorff-distance"],"_links":{"self":[{"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts\/818","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\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/comments?post=818"}],"version-history":[{"count":7,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts\/818\/revisions"}],"predecessor-version":[{"id":1274,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/posts\/818\/revisions\/1274"}],"wp:attachment":[{"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/media?parent=818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/categories?post=818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2021\/wp-json\/wp\/v2\/tags?post=818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}