本文整理汇总了Python中circle.Circle.path方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.path方法的具体用法?Python Circle.path怎么用?Python Circle.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类circle.Circle
的用法示例。
在下文中一共展示了Circle.path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tuple
# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import path [as 别名]
tupleAdd = lambda xs,ys: tuple(x + y for x, y in izip(xs,ys))
def triangleVertices(centerPoint, rotation):
a = tupleAdd(centerPoint, (5*cos(rotation+pi/3),5*sin(rotation+pi/3)))
b = tupleAdd(centerPoint, (5*cos(rotation-pi/3),5*sin(rotation-pi/3)))
c = tupleAdd(centerPoint, (15*cos(rotation),15*sin(rotation)))
return (a,b,c)
#formation = Lemniscate(150,300,200)
formation = Circle(100,300,200)
pathResolution = 200#16*len(swarmbots)
discretePath = []
for i in xrange(0,pathResolution):
discretePath.append(fragmentPoint(formation.arcIntegrand, i*formation.arcLength(0,2*pi)/pathResolution))
discretePath[i] = formation.path(discretePath[i])
print discretePath
headings = []
for i in xrange(0,len(discretePath)):
x1 = discretePath[i][0]
y1 = discretePath[i][1]
x2 = discretePath[(i+1)%len(discretePath)][0]
y2 = discretePath[(i+1)%len(discretePath)][1]
headings.append(atan2(y2-y1,x2-x1))
divisionPoints = []
for i in xrange(0,len(swarmbots)):
divisionPoints.append(fragmentPoint(formation.arcIntegrand, i*formation.arcLength(0,2*pi)/len(swarmbots)))
divisionPoints[i] = formation.path(divisionPoints[i])
robotPositions = list(divisionPoints)