Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.x = x;
- this.y = y;
- this.x1 = x1;
- this.y1 = y1;
- line.setStartX(x);
- line.setStartY(y);
- line.setEndX(x1);
- line.setEndY(y1);
- line.getStrokeDashArray().addAll(4d, 8d);
- double sx = line.getStartX();
- double sy = line.getStartY();
- double ex = line.getEndX();
- double ey = line.getEndY();
- arrow1.setEndX(ex);
- arrow1.setEndY(ey);
- arrow2.setEndX(ex);
- arrow2.setEndY(ey);
- double factor = arrowLength / Math.hypot(sx-ex, sy-ey);
- double factorO = arrowWidth / Math.hypot(sx-ex, sy-ey);
- // part in direction of main line
- double dx = (sx - ex) * factor;
- double dy = (sy - ey) * factor;
- // part ortogonal to main line
- double ox = (sx - ex) * factorO;
- double oy = (sy - ey) * factorO;
- arrow1.setStartX(ex + dx - oy);
- arrow1.setStartY(ey + dy + ox);
- arrow2.setStartX(ex + dx + oy);
- arrow2.setStartY(ey + dy - ox);
- setColor();
- this.getChildren().addAll(arrow1,arrow2, line);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement