当前位置:网站首页>How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
2022-04-23 07:42:00 【0zien0】
We use the ray judgment method to judge whether the point is in the polygon , This point emits a ray in any direction , If the total number of intersections with each edge of the polygon is odd, it is inside the polygon , For the even , Outside the polygon .
If there are thousands on the plane 、 tens of thousands 、 Hundreds of thousands of polygons , Need to judge whether the point falls in one of the polygons ? If you need to judge whether each edge of countless polygons intersects , Extremely inefficient . We use RTree To simplify this complex process .
1. We first convert each polygon into its circumscribed rectangle .
2. Then divide the circumscribed rectangles of all polygons on the map into regions .
3. Establish a good area according to RTree.
Finally, according to RTree Search out the rectangular area intersecting the ray , Then judge whether the point falls in the polygon of the rectangular area . resume RTree after , Just a few decimals to judge , You can quickly calculate which polygon the good point falls in , Even if the number of polygons is huge .
If a single polygon itself is extremely complex , By thousands 、 tens of thousands 、 Hundreds of thousands of edges ? It doesn't mean that a single polygon also needs to judge whether the rays intersect the edges countless times ? The answer is clearly no , We still use RTree To solve this problem .
The principle is basically consistent with the above method , But the above is to convert a polygon into a rectangle and then divide the area , Here is to convert an edge into a rectangle to divide the area . I won't elaborate on the process , The picture above is finished ……
Reference article :https://www.cnblogs.com/LBSer/p/4471742.html
版权声明
本文为[0zien0]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623293902.html
边栏推荐
猜你喜欢
Mysql 数据库从设计上的优化
Solutions to common problems in visualization (VII) solutions to drawing scale setting
Mysql 索引
安装配置淘宝镜像npm(cnpm)
keytool: command not found
h5本地存储数据sessionStorage、localStorage
王者荣耀-unity学习之旅
简易随机点名抽奖(js下编写)
Nacos / sentinel gateway current limiting and grouping (code)
[COCI]Lampice (二分+树分治+字符串哈希)
随机推荐
FSM有限状态机
8. Paging query
页面实时显示当前时间
7. sub query
F-牛妹的苹果树(直径合并)
ESP32学习-GPIO的使用与配置
技能点挖坑
学习笔记7-深度神经网络优化
5. Sql99 standard: internal connection and external connection
10. Update operation
Django使用mysql数据库报错解决
技术小白的第一篇(表达自己)
(扩展)BSGS与高次同余方程
P1390 公约数的和(莫比乌斯反演)
3. Sort statement
数据分析入门 | kaggle泰坦尼克任务(四)—>数据清洗及特征处理
Applet newline character \ nfailure problem resolution - Daily pit stepping
公共依赖模块common的处理
菜菜的刷题日记 | 蓝桥杯 — 十六进制转八进制(纯手撕版)附进制转换笔记
What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)