{"id":200665,"date":"2025-05-06T08:21:16","date_gmt":"2025-05-06T00:21:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200665\/"},"modified":"2025-05-06T08:21:16","modified_gmt":"2025-05-06T00:21:16","slug":"r-%e6%a0%91%e6%98%af%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e9%ab%98%e6%95%88%e7%9a%84%e7%a9%ba%e9%97%b4%e6%95%b0%e6%8d%ae%e7%b4%a2%e5%bc%95%e7%9a%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200665\/","title":{"rendered":"R \u6811\u662f\u5982\u4f55\u5b9e\u73b0\u9ad8\u6548\u7684\u7a7a\u95f4\u6570\u636e\u7d22\u5f15\u7684\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>R \u6811\u662f\u5982\u4f55\u5b9e\u73b0\u9ad8\u6548\u7684\u7a7a\u95f4\u6570\u636e\u7d22\u5f15\u7684\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u4e3b\u673a\u5b9d\u8d1d\u5c31\u6574\u7406\u5206\u4eab\u300aR \u6811\u662f\u5982\u4f55\u5b9e\u73b0\u9ad8\u6548\u7684\u7a7a\u95f4\u6570\u636e\u7d22\u5f15\u7684\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6570\u636e\u5e93\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u4e3b\u673a\u5b9d\u8d1d\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241111\/173129026267316496d7b6c.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>r \u6811\u7684\u5b9e\u73b0\u539f\u7406<\/strong><\/p>\n<p>r \u6811\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u7a7a\u95f4\u7d22\u5f15\u6570\u636e\u7ed3\u6784\uff0c\u7528\u4e8e\u5feb\u901f\u68c0\u7d22\u591a\u7ef4\u7a7a\u95f4\u6570\u636e\uff0c\u7279\u522b\u9002\u7528\u4e8e\u5730\u7406\u4fe1\u606f\u7cfb\u7edf (gis)\u3001\u8ba1\u7b97\u673a\u8f85\u52a9\u8bbe\u8ba1 (cad) \u548c\u56fe\u50cf\u5904\u7406\u7b49\u9886\u57df\u3002<\/p>\n<p><strong>r \u6811\u7684\u539f\u7406<\/strong><\/p>\n<p>r \u6811\u57fa\u4e8e\u4ee5\u4e0b\u5173\u952e\u6982\u5ff5\uff1a<\/p>\n<ul>\n<li><strong>\u8282\u70b9\u5206\u88c2\uff1a<\/strong>\u5f53\u4e00\u4e2a\u8282\u70b9\u7684\u6761\u76ee\u6570\u91cf\u8d85\u8fc7\u6700\u5927\u503c\u65f6\uff0c\u5b83\u5c06\u5206\u88c2\u6210\u4e24\u4e2a\u8282\u70b9\u3002<\/li>\n<li><strong>\u8282\u70b9\u5408\u5e76\uff1a<\/strong>\u5f53\u4e00\u4e2a\u8282\u70b9\u7684\u5b50\u8282\u70b9\u6570\u91cf\u4f4e\u4e8e\u6700\u5c0f\u503c\u65f6\uff0c\u5b83\u53ef\u80fd\u4e0e\u76f8\u90bb\u8282\u70b9\u5408\u5e76\u3002<\/li>\n<li><strong>\u6761\u76ee\uff1a<\/strong>r \u6811\u8282\u70b9\u5305\u542b\u6761\u76ee\u7684\u96c6\u5408\uff0c\u6761\u76ee\u53ef\u4ee5\u662f\u6570\u636e\u8bb0\u5f55\u7684\u6700\u5c0f\u8fb9\u754c\u77e9\u5f62 (mbr)\uff0c\u4e5f\u53ef\u4ee5\u662f\u6307\u5411\u5b50\u6811\u7684\u6307\u9488\u3002<\/li>\n<li><strong>\u9009\u62e9\u987a\u5e8f\uff1a<\/strong>\u5728\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u4e2d\uff0c\u9700\u8981\u9009\u62e9\u5408\u9002\u7684\u8282\u70b9\u8fdb\u884c\u5206\u88c2\u6216\u5408\u5e76\uff0c\u901a\u5e38\u57fa\u4e8e\u542f\u53d1\u5f0f\u7b97\u6cd5\u3002<\/li>\n<li><strong>\u6700\u5c0f\u5316\u91cd\u53e0\uff1a<\/strong>\u5728\u6784\u5efa r \u6811\u65f6\uff0c\u5c3d\u91cf\u51cf\u5c11\u8282\u70b9\u8986\u76d6\u7684\u8303\u56f4\uff0c\u4ee5\u964d\u4f4e\u6570\u636e\u5197\u4f59\u548c\u63d0\u9ad8\u67e5\u8be2\u6548\u7387\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b java \u5b9e\u73b0<\/strong><\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5316\u7684 r \u6811 java \u5b9e\u73b0\u793a\u4f8b\uff1a<\/p>\n<pre>class Node {\n    int count;\n    Entry[] entries;\n    int capacity;\n\n    \/\/ \u7701\u7565\u4ee3\u7801 ...\n}\n\nclass Entry {\n    MBR mbr;\n    Object data;\n\n    \/\/ \u7701\u7565\u4ee3\u7801 ...\n}\n\nclass RTree {\n    Node root;\n    int capacity;\n\n    \/\/ \u7701\u7565\u4ee3\u7801 ...\n}<\/pre>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4<\/strong><\/p>\n<ol>\n<li>\u521b\u5efa mbr \u7c7b\u8868\u793a\u6570\u636e\u70b9\u7684\u8fb9\u754c\u77e9\u5f62\u3002<\/li>\n<li>\u521b\u5efa entry \u7c7b\u8868\u793a r \u6811\u8282\u70b9\u7684\u6761\u76ee\u3002<\/li>\n<li>\u521b\u5efa node \u7c7b\u8868\u793a r \u6811\u8282\u70b9\u3002<\/li>\n<li>\u521b\u5efa rtree \u7c7b\u8868\u793a\u6574\u4e2a r \u6811\u3002<\/li>\n<\/ol>\n<p><strong>\u63d2\u5165\u548c\u5220\u9664<\/strong><\/p>\n<p>r \u6811\u7684\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u9700\u8981\u9012\u5f52\u8c03\u7528\u8282\u70b9\u7684\u6dfb\u52a0\u548c\u5220\u9664\u65b9\u6cd5\uff0c\u8003\u8651\u8282\u70b9\u7684\u5206\u88c2\u548c\u5408\u5e76\u3002<\/p>\n<p><strong>\u67e5\u8be2<\/strong><\/p>\n<p>r \u6811\u7684\u67e5\u8be2\u9700\u8981\u9012\u5f52\u641c\u7d22\u6240\u6709\u4e0e\u67e5\u8be2 mbr \u76f8\u4ea4\u7684\u8282\u70b9\u548c\u6761\u76ee\u3002<\/p>\n<p><strong>\u603b\u7ed3<\/strong><\/p>\n<p>r \u6811\u901a\u8fc7\u5c06\u6570\u636e\u9879\u7ec4\u7ec7\u5728\u6811\u7ed3\u6784\u4e2d\uff0c\u6700\u5c0f\u5316\u6bcf\u4e2a\u8282\u70b9\u7684\u8fb9\u754c\u77e9\u5f62\u8986\u76d6\u8303\u56f4\uff0c\u51cf\u5c11\u6570\u636e\u5197\u4f59\u5e76\u63d0\u9ad8\u67e5\u8be2\u6548\u7387\u3002\u5176\u5b9e\u73b0\u6d89\u53ca\u8282\u70b9\u5206\u88c2\u3001\u5408\u5e76\u548c\u6700\u5c0f\u5316\u91cd\u53e0\u7b49\u590d\u6742\u95ee\u9898\uff0c\u4f46\u5b83\u5728\u5904\u7406\u7a7a\u95f4\u6570\u636e\u65f6\u662f\u4e00\u79cd\u975e\u5e38\u6709\u6548\u7684\u7a7a\u95f4\u7d22\u5f15\u5de5\u5177\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aR \u6811\u662f\u5982\u4f55\u5b9e\u73b0\u9ad8\u6548\u7684\u7a7a\u95f4\u6570\u636e\u7d22\u5f15\u7684\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>R \u6811\u662f\u5982\u4f55\u5b9e\u73b0\u9ad8\u6548\u7684\u7a7a\u95f4\u6570\u636e\u7d22&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200665","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200665"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200665\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}