當前位置: 首頁>>代碼示例>>Python>>正文


Python Polygon.addContour方法代碼示例

本文整理匯總了Python中Polygon.addContour方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.addContour方法的具體用法?Python Polygon.addContour怎麽用?Python Polygon.addContour使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Polygon的用法示例。


在下文中一共展示了Polygon.addContour方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: remove_short_lines

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import addContour [as 別名]
	def remove_short_lines(self, minlen = 1):
		minlen*=minlen
		newp = Polygon()
		c=-1
		for cont in self.poly:
			c+=1
			#cont=self.poly[0]
			keeplist = []
			lastp = None
			pindex = -1
			for p in cont:
				pindex+=1
				if lastp:
					#check here
					xd = p[0]-lastp[0]
					yd = p[0]-lastp[0]
					td = xd*xd+yd*yd
					if td < minlen:
						pass
						#lastp = None
					else:
						keeplist.append(p)
						lastp = p
				else:
					keeplist.append(p)
					lastp = p
			ishole = self.poly.isHole(c)
			newp.addContour(keeplist,ishole)
		self.poly = newp
開發者ID:chozabu,項目名稱:KivEntEd,代碼行數:31,代碼來源:PolyGen.py

示例2: remove_some_pts

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import addContour [as 別名]
	def remove_some_pts(self, prop=.9):
		newp = Polygon()
		c=-1
		for cont in self.poly:
			c+=1
			cr = reducePoints(cont,int(len(cont)*prop))
			ishole = self.poly.isHole(c)
			if len(cr)>2:
				newp.addContour(cr, ishole)
		parea = self.poly.area()
		nparea = newp.area()
		#areadiff = math.fabs(nparea-parea)
		arearatio = parea/nparea
		arearatio = math.fabs(arearatio-1)
		#print areadiff, arearatio
		if arearatio < 0.1:
			self.poly = newp
開發者ID:chozabu,項目名稱:KivEntEd,代碼行數:19,代碼來源:PolyGen.py

示例3: from_spline

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import addContour [as 別名]
	def from_spline(self, points):
		newp = Polygon()
		#print points
		newp.addContour(points)
		self.poly = newp
開發者ID:chozabu,項目名稱:KivEntEd,代碼行數:7,代碼來源:PolyGen.py

示例4: updateBbox

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import addContour [as 別名]
        # for each contour in the jpoly
        for c in contours:
            # remove last redundant coordinate from each contour
            # (Tangram doesn't like this - it needs the last coordinate
            # to draw the last face properly)
            # del c[-1]

            # for each vertex
            # for v in c:
            # offset all verts in tile to arrange in scenespace
            # this isn't necessary when the data is coming straight from the json,
            # only when the data is coming from a tangram vbo
            # v = [v[0]+(4096*(tilemax[0]-tile.x)), v[1]+(4096*(tilemax[1]-tile.y))]

            poly.addContour(c)

            # update tile's bbox with contour's bbox
            t.bbox = updateBbox(t.bbox, list(poly.boundingBox()))

        poly.tile = t
        t.polys.append(poly)

printStatus("100%")


# make a list of all polys
# this list comprehension is the same as the nested for loops below
# neat, eh? ...but harder to read :/
# polys = [p for t in tiles for p in t.polys]
開發者ID:klwiley,項目名稱:landgrab,代碼行數:31,代碼來源:dedupe.py


注:本文中的Polygon.addContour方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。