- 浏览: 99744 次
- 性别:
- 来自: HK
文章分类
最新评论
-
Mr.小裤裤:
谢谢,
我生日过的很快乐,
o(∩_∩)o...
system badimageformatexception and its partial solution
link: http://paulbourke.net/geometry/insidepoly/
here is the python code snippet:
def point_inside_polygon(cls, lon,lat, coors):
n = len(coors)
inside = False
p1x,p1y = coors[0]
for i in xrange(n+1):
p2x,p2y = coors[i % n]
if lat > min(p1y,p2y):
if lat <= max(p1y,p2y):
if lon <= max(p1x,p2x):
if p1y != p2y:
xinters = (lat-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
if p1x == p2x or lon <= xinters:
inside = not inside
p1x,p1y = p2x,p2y
return inside
the following is a cython version:
cpdef point_inside_polygon(double x,double y,list poly):
cdef int n = len(poly)
inside = False
cdef int i
cdef double p1x,p1y,p2x,p2y,xinters
p1x,p1y = poly[0]
for i in xrange(n+1):
p2x,p2y = poly[i % n]
if y > min(p1y,p2y):
if y <= max(p1y,p2y):
if x <= max(p1x,p2x):
if p1y != p2y:
xinters = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
if p1x == p2x or x <= xinters:
inside = not inside
p1x,p1y = p2x,p2y
return inside
the cython version is 10x faster that the first.
发表评论
-
static building lxml
2014-08-13 19:15 817well it is not really straig ... -
build pyrun/python from source
2014-08-01 19:39 586quite easy on ubuntu. 1: ... -
build apsw manually
2014-01-06 01:22 545download sqlite sources and co ... -
python, vs 2010 & manifest problem
2013-11-02 13:33 631It looks like python com ... -
numpy 1.7.0 fails with cx_freeze 4.3.1
2013-02-24 16:13 851It is a work around: find ... -
build psycopg2 on windows with mingw64
2013-01-03 20:36 967caution: version match problem. ... -
pypy的一个测试
2012-06-09 16:15 1608pypy-1.9 昨天已经发布,据称性能又有所提高。 ... -
a naive way to use dictcursor of psycopg2 with twisted adbapi
2012-05-03 03:14 1165make a new file called fakedb.p ... -
build psycopg2 on windows with vs
2012-05-02 02:16 865prerequisites: 1: postgresq ... -
twisted iocp reactor is still buggy---it was fixed on 23/10/2012
2012-03-19 14:53 1260I reported a bug on last wee ... -
One way to speed up Pb invoke.
2012-03-14 21:31 844Pb (stands for Perspecti ... -
change buffer size in order to send chunks data in ampoule
2011-12-03 16:08 803ampoule use name pipe to commun ... -
which one is thread safe?
2011-09-21 12:31 918quote: It's not so much tha ... -
cython的另类用途
2011-08-04 02:30 1569都知道py虽然方便但是却有个不是问题的问题:就是发布时的二进制 ... -
instructions for installing some python's pkgs on ubuntu
2011-07-23 00:54 784make sure python-dev, gcc and o ... -
a tedious way to build the latest pytables
2011-07-17 03:33 715pyTables is a great product. It ... -
再谈twisted
2011-06-29 17:03 1435现在我手头用的是11.0。 很好。没什么很大的问题,原来的版本 ... -
cython的效果
2011-06-29 00:29 806我有个用py写的 crc-ccitt的验证程序(实现效率并不高 ... -
the simplest way to use vs 2010 with python
2011-06-03 15:48 671edit py/Lib/distutils/msvc9comp ... -
speeding up python
2011-06-03 15:36 881python确实是十分慢的语 ...
相关推荐
Determining the required stack sizes for a software project is a crucial part of the development process. The developer aims to create a stable application, while not wasting resources. This ...
Anyone using this document should rely on his or her own independent judgment or, as appropriate, seek the advice of a competent professional in determining the exercise of reasonable care in any ...
gmw 3205 Determining the Resistance to Odor Propagation of Interior Materials.pdf
If there is no clustered index, there is a sysindexes row for the table with an indid value of 0, and that row will keep track of the address of the first IAM for the table. The IAM is a giant bitmap...
ganalysis - the analysis and classi¯cation method of determining if an audio medium is carrying hidden information. In this paper, we propose a novel distortion metric based on Hausdor® distance. ...
Watershed planners need a tool for determining width of filter strips that is accurate enough for developing cost-effective site designs and easy enough to use for making quick determinations on a ...
《投资估值:工具与技术确定任何资产的价值》第二版,由Aswath Damodaran撰写,是MBA投资课程中的经典教材。这本书深入探讨了资产估值的理论与实践,为读者提供了全面而深刻的见解。以下是对书中部分章节的详细解析...
3. **Path Planning**: Path planning algorithms are essential for determining the optimal route from the current position to a target destination. PythonRobotics covers various path planning methods, ...
In this research, the focus lies on the legal issues surrounding the protection of the owner's rights during the process of urban housing demolition. The author argues for a more comprehensive and ...
SAE ARP8463 Methods for Determining the Effect of Liquid Disinfectants on Seats in Transport Aircraft.pdf
The third edition has three new chapters on unusual topics related to Kalman filtering and other filtering techniques based on the method of least squares.Chapter 17 presents a type of filter known ...
【最新】 SAE ARP8463 Methods for Determining the Effect of Liquid Disinfectants on Seats in Transport Aircraft.pdf
混杂系统是实际系统中一类重要的模型,具有广泛的应用领域,例如制造业、空中交通管理系统、机器人技术等。混杂系统的研究涉及多个学科领域,包括系统控制、优化、非光滑分析等。 在混杂系统的研究中,"生存域"是一...
from Finance at Northeastern University delves into the methodologies and principles used in assessing the worth of financial instruments that guarantee a series of known future cash flows, ...
【最新版】 SAE ARP8463 Methods for Determining the Effect of Liquid Disinfectants on Seats in Transport Aircraft.pdf
Determining the length of a string 49 Comparing strings 50 Comparing a string of characters 51 Locating the first instance of a character 52 Locating the index of a character 53 Determining the class ...
In all cases, the alarm concentration and explosion lower limit are first reached vertically above the leakage point on the soil surface, but the time varies depending on the specific conditions. ...