static int drawArrowBetweenPoints_width = 4; static double drawArrowBetweenPoints_headScale = 2; static void drawArrowBetweenPoints(Graphics2D g, Pt p1, Pt p2, Color color) { int x1 = p1.x, y1 = p1.y, x2 = p2.x, y2 = p2.y; double dist = pointDistance(x1, y1, x2, y2); double headSize = drawArrowBetweenPoints_width*drawArrowBetweenPoints_headScale*drawArrowHead_length+2; // 2 = gap DoublePt v = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), headSize/dist); DoublePt p = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), 0); g.setColor(color); g.setStroke(new BasicStroke(drawArrowBetweenPoints_width)); g.draw(new Line2D.Double(x1, y1, v.x, v.y)); drawArrowHead(g, x1, y1, p.x, p.y, drawArrowBetweenPoints_width*drawArrowBetweenPoints_headScale); }
Began life as a copy of #1015607
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015613 |
Snippet name: | drawArrowBetweenPoints |
Eternal ID of this version: | #1015613/1 |
Text MD5: | 6f60f5e172b6fbf53e420ba8aa455871 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-19 20:22:04 |
Source code size: | 803 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 368 / 410 |
Referenced in: | [show references] |