如何判断多边形是否在Python中的另一个多边形内?

时间:2019-04-25 02:19:54

标签: python

我需要定义一个Python函数,该函数可以确定凸多边形(多边形a)是否在另一个多边形(多边形b)内部。

给出了每个多边形的顶点。

(仅使用基本lib和numpy)

人类很容易用眼睛做出判断。但是我不知道如何在Python中描述该方法。我试图检查lib的某些源代码(例如匀称),但无法理解它是如何工作的。 '''

def isinside(polya, polyb):
     #Polya: [(x1,y1), (x2,y2), (x3,y3),...]
     #Polyb: [(x1,y1), (x2,y2), (x3,y3),...]
    #if polya inside polyb
     return True
     # else 
     return False

''' 有人可以提供一些建议或显示一些代码吗?谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用/opt/R-3.4.0/library/BH/include/boost/throw_exception.hpp:In function`void boost::throw_exception(const E&)`: /opt/R-3.4.0/library/BH/include/boost/throw_exception.hpp:70:error`enable_ both:` is not a member of `boost::exception_detail` In file included from /opt/R-3.4.0/library/BH/include/boost/random/detail/integer_log2.hpp:19, from /opt/R-3.4.0/library/BH/include/boost/random/detail/large_arithmetic.hpp:19, from /opt/R-3.4.0/library/BH/include/boost/random/detail/const_mod.hpp:23, from /opt/R-3.4.0/library/BH/include/boost/random/linear_congruential.hpp:30, from /opt/R-3.4.0/library/BH/include/boost/random/additive_combine.hpp:27, from chains.cpp:29: /opt/R-3.4.0/library/BH/include/boost/pending/integer_log2.hpp:At global scope: /opt/R-3.4.0/library/BH/include/boost/pending/integer_log2.hpp:7:note:#pragma message :This header is deprecated .Use <boost/integer/integer_log2.hpp> instead. make: *** [chains.o] Error 1 Error:compilation failed for package `rstan` 库。就像

shapely

该模块提供了有关大多数与几何相关的操作的更多信息,因此请参考their User Manual以获取更多示例和详尽的解释。