转换简化离散区域边界多边形 [英] Convert simplified discrete area to borders polygon

查看:184
本文介绍了转换简化离散区域边界多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有独立的地图,在这张地图上出现的国家再通过颜色psented $ P $蓝:

国家地区始终是一致的。

现在我想从中提取边界:

所以:

  • 在我的国家无序地砖的列表,在这种情况下:(3,3),(4,3),(4,4)...
  • 我要提取的边界有序序列,在这种情况下:((2,2),(3,2)),((3,2),(4,2)),....,其中( (X1,Y1),(X2,Y2))表示边界beggining开始在(X1,Y1),并结束在(X2,Y2)
解决方案
  1. 首先找到右端点在你的矩阵无论多么高。如果你瑶池点相同的x,任意选择。
  2. 找到这个点的所有边界。
  3. 如果你有一个点接壤 前,去了,否则进入 正确的,否则到了底部,否则 向左走,去的方向 其中,有边境另一点, 总是以该顺序。如果遇到 点是起点,去 步骤7,否则到下一个步骤。
  4. 存储两个点(主 点,遇到点)在 路径。
  5. 现在,遇到的问题是 主点。
  6. 转到步骤2
  7. 路径中包含你想要什么

suppose that I have discrete map, on this map appears country represented by color blue:

country area is always coherent.

Now I want to extract borders from it:

So:

  • I have a list of unordered tiles of country, in this case: (3,3), (4,3), (4,4)...
  • I want to extract ordered sequence of borders, in this case: ((2,2),(3,2)), ((3,2),(4,2)),.... where ((x1,y1),(x2,y2)) means that beggining of border starts in (x1,y1) and ends in (x2,y2)

解决方案

  1. Firstly find the rightest point in your matrix no matter how tall. If you finded points with same x, choose arbitrarily.
  2. Find all borders of this point.
  3. If you have a point bordering on top, go for it, else go to the right, else go to the bottom, else go to the left, go to the direction where have border with other point, always in that order. If encountered point is the initial point, go to step 7, else go to the next step.
  4. store the two points (principal point, encountered point) in your path.
  5. Now the encountered point is principal point.
  6. Go to step 2
  7. the path contains what you want

这篇关于转换简化离散区域边界多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆