예제 #1
0
def arcTo(self, cx, cy, p2x, p2y):
	"""Adds a segment from the current position to p2x, p2y by drawing part of a circle centered on 'cx,cy'"""
	p1x, p1y = self.nodes[-1].position2()
	angle1 = Math.atan2(-(p1y-cy), p1x-cx)
	angle2 = Math.atan2(-(p2y-cy), p2x-cx)
	if (angle2-angle1>Math.PI):
		angle2-=Math.PI*2
	if (angle2-angle1<-Math.PI):
		angle2+=Math.PI*2
	self.arc(Math.sqrt( (p1x-cx)*(p1x-cx)+(p1y-cy)*(p1y-cy)), cx,cy, angle1, angle2, join=1)
	return self