def shortenpath(self, dists):
"""shortens a path by the given distances"""
# XXX later, this should be done by extended boxes instead of intersecting with circles
# cut off the start of self
center = self.atbegin_pt()
cutpath = path.circle_pt(center[0], center[1], dists[0])
try:
cutpath = cutpath.normpath()
except normpath.NormpathException:
pass
else:
sp = self.intersect(cutpath)[0]
self.normsubpaths = self.split(sp[-1:])[1].normsubpaths
# cut off the end of self
center = self.atend_pt()
cutpath = path.circle_pt(center[0], center[1], dists[1])
try:
cutpath = cutpath.normpath()
except normpath.NormpathException:
pass
else:
sp = self.intersect(cutpath)[0]
if sp:
self.normsubpaths = self.split(sp[:1])[0].normsubpaths
################
## classes
################
评论列表
文章目录