return fsolve(arcFragment, 0.0, (integrand, fragLength))[0] 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])