本文整理匯總了Python中Polygon.nPoints方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.nPoints方法的具體用法?Python Polygon.nPoints怎麽用?Python Polygon.nPoints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Polygon
的用法示例。
在下文中一共展示了Polygon.nPoints方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Polygon
# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import nPoints [as 別名]
class Solid:
name = "solid"
id = 0
polygon = Polygon()
material = Material()
def __init__(self, points):
self.polygon = Polygon(points)
def fill(self, particles):
xmin, xmax, ymin, ymax = self.polygon.boundingBox()
d2 = 2 * self.material.d
x = xmin
while x < xmax:
x += d2
y = ymin
while y < ymax:
y += d2
if self.polygon.isInside(x, y):
id = len(particles)
particles.append(self.material.createParticle(x, y, id))
pass
def setInfo(self, name, id):
self.name = name
self.id = id
def setMaterial(self, material):
self.material = material
def scaleIn(self, scale):
self.polygon.scale(scale, scale, 0.0, 0.0)
def scaleOut(self, scale):
self.polygon.scale(1.0 / scale, 1.0 / scale, 0.0, 0.0)
def points(self):
return self.polygon[0]
def len(self):
return self.polygon.nPoints(0)