本文整理汇总了Python中nodebox.graphics.Transform.translated方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.translated方法的具体用法?Python Transform.translated怎么用?Python Transform.translated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nodebox.graphics.Transform
的用法示例。
在下文中一共展示了Transform.translated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: translate
# 需要导入模块: from nodebox.graphics import Transform [as 别名]
# 或者: from nodebox.graphics.Transform import translated [as 别名]
def translate(s):
a = to_number_array(s)
tx = a[0]
ty = 0
if len(a) > 1:
ty = a[1]
return Transform.translated(tx, ty)
示例2: pack
# 需要导入模块: from nodebox.graphics import Transform [as 别名]
# 或者: from nodebox.graphics.Transform import translated [as 别名]
def pack(shapes, iterations, padding, seed):
_seed(seed)
packed_objects = []
for path in shapes:
packed_objects.append(PackObject(path))
for i in xrange(1, iterations):
_pack(packed_objects, damping=0.1/i, padding=padding)
geo = Geometry()
for po in packed_objects:
print po.x, po.y
p = Transform.translated(po.x, po.y).map(po.path)
geo.add(p)
return geo
示例3: translate
# 需要导入模块: from nodebox.graphics import Transform [as 别名]
# 或者: from nodebox.graphics.Transform import translated [as 别名]
def translate(shape, translate):
"""Move the shape."""
if shape is None: return None
return Transform.translated(translate).map(shape)