{"id":194,"date":"2021-01-18T07:16:18","date_gmt":"2021-01-17T23:16:18","guid":{"rendered":"http:\/\/liyanliang.net\/?p=194"},"modified":"2021-01-18T07:21:08","modified_gmt":"2021-01-17T23:21:08","slug":"%e5%8e%bb%e9%99%a4%e9%87%8d%e5%8f%a0%e7%9a%84%e9%97%ad%e5%90%88%e5%8c%ba%e5%9f%9f","status":"publish","type":"post","link":"http:\/\/liyanliang.net\/index.php\/2021\/01\/18\/%e5%8e%bb%e9%99%a4%e9%87%8d%e5%8f%a0%e7%9a%84%e9%97%ad%e5%90%88%e5%8c%ba%e5%9f%9f\/","title":{"rendered":"\u53bb\u9664\u91cd\u53e0\u7684\u95ed\u5408\u533a\u57df"},"content":{"rendered":"\n<p class=\"has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\">\u9898\u76ee\u63cf\u8ff0<\/p>\n\n\n\n<p>\u5728\u56fe\u5f62\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u6c42\u6700\u5c0f\u95ed\u5408\u533a\u57df\uff0c\u5f53\u83b7\u5f97\u4e86\u6240\u6709\u7684\u95ed\u5408\u533a\u57df\u540e\uff0c\u6709\u4e00\u90e8\u5206\u533a\u57df\u662f\u91cd\u53e0\u7684\uff0c\u73b0\u8bbe\u8ba1\u7b97\u6cd5\u5c06\u91cd\u53e0\u7684\u533a\u57df\u5220\u9664\u3002\uff08\u6b64\u7b97\u6cd5\u7c7b\u4f3c\u4e8e \u5220\u9664\u65e0\u5e8f\u6570\u7ec4\u4e2d\u91cd\u590d\u7684\u5143\u7d20\uff09<\/p>\n\n\n\n<p class=\"has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\">\u4e00\u3001\u53bb\u9664\u91cd\u53e0\u7684\u56fe\u5f62<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u53bb\u9664\u91cd\u53e0\u7684\u56fe\u5f62\nstd::vector> removeOverlapArea(vector> ClosedArea)\n{\n\/\/> \u8868\u793a\u4e00\u4e2a\u95ed\u5408\u533a\u57df,\u6709\u591a\u6761\u7ebf\u6bb5\u56f4\u6210\n\/\/vector> \u8868\u793a\u95ed\u5408\u533a\u57df\u7684\u96c6\u5408\n \u00a0 \u00a0unsigned int nSize = ClosedArea.size();\n \u00a0 \u00a0if (nSize &amp;lt; 2) \/\/\u53ea\u6709\u4e00\u500b\u9589\u5408\u5340\u57df\n \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0return ClosedArea;\n \u00a0  }\n\u200b\n\/\/\u53bb\u9664\u91cd\u53e0\u7684\u533a\u57df\nsize_t n = ClosedArea.size();\nsize_t j = 0;\n\u200b\nfor (size_t i=0; i &amp;lt; n; i++)\n{\n \u00a0 \u00a0for(size_t j=0;j&amp;lt;i;j++)\n \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0\/\/if(arr[i]arr[j])\n \u00a0 \u00a0 \u00a0 \u00a0if(IsOverlap(ClosedArea[i],ClosedArea[j]))\n \u00a0 \u00a0 \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0n--;\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0for (size_t k=i; k&amp;lt;n; k++)\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0ClosedArea[k]=ClosedArea[k+1];\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  }\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0i--; \u00a0 \u00a0\n \u00a0 \u00a0 \u00a0  }\n \u00a0  }\n}\n\u200b\nvector&amp;lt;vector&amp;lt;CLine>>::iterator it1,it2;\n\u200b\nit1 = ClosedArea.begin() + n;\nit2 = ClosedArea.end();\n\u200b\nClosedArea.erase(it1,it2);\n\u200b\nreturn ClosedArea;\n\u200b\n}<\/pre>\n\n\n\n<p class=\"has-cyan-bluish-gray-background-color has-background\" id=\"block-823b0f69-df5a-4ce0-a891-a54ea94bf3d7\">\u4e8c\u3001\u5224\u65ad\u662f\u5426\u662f\u91cd\u5408\u7684\u56fe\u5f62<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u5224\u65ad\u662f\u5426\u662f\u91cd\u5408\u7684\u56fe\u5f62\nbool IsOverlap(vector AreaLeft,vector AreaRight) \n{\n \u00a0  for (unsigned int i = 0;i &amp;lt; AreaLeft.size(); i++)\n \u00a0  {\n \u00a0 \u00a0 \u00a0  CLine m_lineLeft = AreaLeft[i];\n \u00a0 \u00a0 \u00a0  bool bEqualLine = false;\n \u00a0 \u00a0 \u00a0  for (unsigned int j = 0;j &amp;lt; AreaRight.size();j++)\n \u00a0 \u00a0 \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  if (m_lineLeft.isEqual(AreaRight[j]))\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  bEqualLine = true;\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  }\n \u00a0 \u00a0 \u00a0  }\n \u00a0 \u00a0 \u00a0  if (bEqualLine  false)\n \u00a0 \u00a0 \u00a0  {\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  return false; \/\/\u53ea\u8981\u6709\u4e00\u6761\u7ebf\u6bb5\u4e0d\u76f8\u540c,\u5fc5\u7136\u4e0d\u91cd\u5408\n \u00a0 \u00a0 \u00a0  }\n \u00a0  }\n \u00a0  return true;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee\u63cf\u8ff0 \u5728\u56fe\u5f62\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u6c42\u6700\u5c0f\u95ed\u5408\u533a\u57df\uff0c\u5f53\u83b7\u5f97\u4e86\u6240\u6709\u7684\u95ed\u5408\u533a\u57df\u540e\uff0c\u6709\u4e00\u90e8\u5206\u533a\u57df\u662f\u91cd\u53e0\u7684\uff0c\u73b0\u8bbe\u8ba1\u7b97\u6cd5\u5c06\u91cd\u53e0\u7684\u533a\u57df\u5220\u9664\u3002\uff08\u6b64\u7b97\u6cd5\u7c7b\u4f3c\u4e8e \u5220\u9664\u65e0\u5e8f\u6570\u7ec4\u4e2d\u91cd\u590d\u7684\u5143\u7d20\uff09 \u4e00\u3001\u53bb\u9664\u91cd\u53e0\u7684\u56fe\u5f62 \u4e8c\u3001\u5224\u65ad\u662f\u5426\u662f\u91cd\u5408\u7684\u56fe\u5f62<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[23],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-19","tag-23"],"_links":{"self":[{"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":2,"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":197,"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/posts\/194\/revisions\/197"}],"wp:attachment":[{"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/liyanliang.net\/index.php\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}