本文整理匯總了Python中Polygon.setTolerance方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.setTolerance方法的具體用法?Python Polygon.setTolerance怎麽用?Python Polygon.setTolerance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Polygon
的用法示例。
在下文中一共展示了Polygon.setTolerance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: line2pointIntersection
# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import setTolerance [as 別名]
from mrpolygons import mrpolygon, scalePolygon, polarPolygon2cartesian, transportPolygonGeometry, transportPolygon
import Polygon
Polygon.setTolerance(1e-3)
from Polygon import Polygon
from Polygon.Utils import fillHoles, prunePoints, reducePoints
import numpy
import os
import sys
import imp
from contiguity import weightsFromAreas
def line2pointIntersection(line,point,tol):
if line.distance(point) < tol:
return point
else:
return None
def line2mpointsIntersection(line,mpoints,tol):
result = []
for point in mpoints:
if line2pointIntersection(line,point,tol) != None:
result.append(point)
if len(result) >= 2:
intersection = result.sort(key=lambda x: Point(line.coords[0]).distance(Point(x)))
return result
class rimap():
def __init__(self,n=3600,N=30,alpha=[0.1,0.5],sigma=[1.1,1.4],dt=0.1,pg=0.01,pu=0.05,su=0.315,boundary=""):
"""Creates an irregular maps
:param n: number of areas
示例2: __init__
# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import setTolerance [as 別名]
#!/usr/bin/env python
import math,re, os, random
import Polygon, Polygon.IO, Polygon.Utils
import project
from regions import *
import itertools
import decomposition
Polygon.setTolerance(0.1)
class parseLP:
"""
A parser to parse the locative prepositions in specification
"""
def __init__(self):
pass
def main(self,argv):
""" Main function; run automatically when called from command-line """
spec_file = argv
self.regionNear = []
self.regionBetween = []
defaultNearDistance = 50
# load data
self.proj = project.Project()
self.proj.setSilent(True)
self.proj.loadProject(spec_file)
示例3: __init__
# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import setTolerance [as 別名]
def __init__(self, poly=None, color=(1,1,1,0.9), keepsimple = False, minlinelen=2):
self.color = color
self.poly = poly
self.keepsimple = keepsimple
po.setTolerance(0.1)
self.minlinelen = minlinelen