如何确定多边形是否在另一个多边形之内? [英] How to determine whether a polygon is inside other one?

查看:195
本文介绍了如何确定多边形是否在另一个多边形之内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的示例( SVG来源)如下所示. d 属性中描述的ID为" rect2816 "的路径:

I have a simple example (SVG source) looks like you can see below. The path with id "rect2816" described in d attribute:

m 140.53571,188.625 0,148.1875 273.9375,0 0,-148.1875 -273.9375,0 z 
m 132.25,42.03125 c 3.64586,0.0236 7.47296,0.12361 11.5,0.28125 36.65941,1.43507 57.84375,15.88072 57.84375,32.84375 0,7.41614 -1.94981,21.58652 -13.28125,24.09375 -14.58711,3.2276 -40.46224,-5.35276 -53.125,6.625 -26.65285,25.21104 -48.00843,-19.04537 -57.875,-32.84375 -12.16196,-17.00847 0.24962,-31.35357 54.9375,-31 z

在这里,第一行描述了父多边形,第二行描述了孔(如您所见).但是如何找到这种孔编程方式?我正在使用Python.也许有一些简单的解决方案库?

Here, the first line describes parent polygon, the second - the hole (as you can see). But How can I find this hole program way? I'm using Python. Maybe there is some library for easy solution?

推荐答案

将路径转换为(x,y)对,并将此函数应用于第二个多边形的每个点.

Transform the paths into (x,y) pairs and apply this function for each point of the second polygon.

http://www.ariel.com.au/a/python-point-int-poly.html

这篇关于如何确定多边形是否在另一个多边形之内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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