static int drawArrowBetweenRects_headSize = 5; static int drawArrowBetweenRects_width = 2; static void drawArrowBetweenRects(Graphics2D g, Rect r1, Rect r2, Color color) { // TODO Pt p1 = pt(r1.x+r1.w/2, r1.y-1); Pt p2 = pt(r2.x+r2.w/2, r2.y+r2.h); int x1 = p1.x, y1 = p1.y, x2 = p2.x, y2 = p2.y; double dist = pointDistance(x1, y1, x2, y2); double arrowLen = drawThoughtArrow_size*drawArrowHead_length-1; DoublePt v = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), (cs+arrowLen)/dist); DoublePt p = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), cs/dist); Graphics2D g = imageGraphics(bg); g.setColor(color); g.setStroke(new BasicStroke(drawArrowBetweenRects_width)); g.draw(new Line2D.Double(x1, y1, v.x, v.y)); drawArrowHead(g, x1, y1, p.x, p.y, drawArrowBetweenRects_headSize); }