def findRelativeAngle(parent, angle): # deterine the parent angle # adjust with child angles x = parent.points[1].x - parent.points[0].x y = parent.points[1].y - parent.points[0].y r, parentAngle = xy_to_polar([x, y]) radians = (angle/360.0 * 2*pi) return parentAngle + radians
def arrow(path, headwidth, headheight, filled=False): '''Returns an arrow shape. - `path` is a Path object. - `headwidth` is the width of the arrow head. - `headheight` is the height of the arrow head. ''' ## make arow head... r, a = xy_to_polar((path.points[-1] - path.points[-2])) head = isosceles(headwidth, headheight, filled) offset(head, (0, -headheight)) rotate(head, a - math.pi / 2, (0, 0)) offset(head, path.points[-1]) return Group([head, path])
def polar(self): from chiplotle.tools.mathtools.xy_to_polar import xy_to_polar return xy_to_polar(self.xy)