def line_angle(position, angle, distance): p = Path() x1, y1 = coordinates(position.x, position.y, distance, angle) p.line(position.x, position.y, x1, y1) p.strokeColor = Color.BLACK p.strokeWidth = 1 return p
def makecurve(pt1, pt2, c1, c2): p = Path() p.moveto(pt1.x, pt1.y) p.curveto(c1.x, c1.y, c2.x, c2.y, pt2.x, pt2.y) p.fill = None p.stroke = Color.BLACK p.strokeWidth = 1.0 return p
def connect(points, closed=True): """Connects all points in a path.""" if points is None: return None if len(points) < 2: return None points = list(points) start = points[0] p = Path() p.moveto(start.x, start.y) for point in points[1:]: p.lineto(point.x, point.y) if closed: p.close() p.stroke = Color.BLACK p.strokeWidth = 1.0 return p
def quad_curve(pt1, pt2, t, distance): t /= 100.0 cx = pt1.x + t * (pt2.x - pt1.x) cy = pt1.y + t * (pt2.y - pt1.y) a = angle(pt1.x, pt1.y, pt2.x, pt2.y) + 90 qx, qy = coordinates(cx, cy, distance, a) p = Path() p.moveto(pt1.x, pt1.y) c1x = pt1.x + 2 / 3.0 * (qx - pt1.x) c1y = pt1.y + 2 / 3.0 * (qy - pt1.y) c2x = pt2.x + 2 / 3.0 * (qx - pt2.x) c2y = pt2.y + 2 / 3.0 * (qy - pt2.y) p.curveto(c1x, c1y, c2x, c2y, pt2.x, pt2.y) p.fill = None p.stroke = Color.BLACK p.strokeWidth = 1.0 return p
def quad_curve(pt1, pt2, t, distance): t /= 100.0 cx = pt1.x + t * (pt2.x - pt1.x) cy = pt1.y + t * (pt2.y - pt1.y) a = angle(pt1.x, pt1.y, pt2.x, pt2.y) + 90 qx, qy = coordinates(cx, cy, distance, a) p = Path() p.moveto(pt1.x, pt1.y) c1x = pt1.x + 2/3.0 * (qx - pt1.x) c1y = pt1.y + 2/3.0 * (qy - pt1.y) c2x = pt2.x + 2/3.0 * (qx - pt2.x) c2y = pt2.y + 2/3.0 * (qy - pt2.y) p.curveto(c1x, c1y, c2x, c2y, pt2.x, pt2.y) p.fill = None p.stroke = Color.BLACK p.strokeWidth = 1.0 return p
def line(point1, point2): p = Path() p.line(point1.x, point1.y, point2.x, point2.y) p.strokeColor = Color.BLACK p.strokeWidth = 1 return p