Return the paths for arrow heads. Since arrow lines are drawn with capstyle=projected, The arrow goes beyond the desired point. This method also returns the amount of the path to be shrunken so that it does not overshoot.
(self, x0, y0, x1, y1,
head_dist, cos_t, sin_t, linewidth)
| 3506 | super().__init__() |
| 3507 | |
| 3508 | def _get_arrow_wedge(self, x0, y0, x1, y1, |
| 3509 | head_dist, cos_t, sin_t, linewidth): |
| 3510 | """ |
| 3511 | Return the paths for arrow heads. Since arrow lines are |
| 3512 | drawn with capstyle=projected, The arrow goes beyond the |
| 3513 | desired point. This method also returns the amount of the path |
| 3514 | to be shrunken so that it does not overshoot. |
| 3515 | """ |
| 3516 | |
| 3517 | # arrow from x0, y0 to x1, y1 |
| 3518 | dx, dy = x0 - x1, y0 - y1 |
| 3519 | |
| 3520 | cp_distance = np.hypot(dx, dy) |
| 3521 | |
| 3522 | # pad_projected : amount of pad to account the |
| 3523 | # overshooting of the projection of the wedge |
| 3524 | pad_projected = (.5 * linewidth / sin_t) |
| 3525 | |
| 3526 | # Account for division by zero |
| 3527 | if cp_distance == 0: |
| 3528 | cp_distance = 1 |
| 3529 | |
| 3530 | # apply pad for projected edge |
| 3531 | ddx = pad_projected * dx / cp_distance |
| 3532 | ddy = pad_projected * dy / cp_distance |
| 3533 | |
| 3534 | # offset for arrow wedge |
| 3535 | dx = dx / cp_distance * head_dist |
| 3536 | dy = dy / cp_distance * head_dist |
| 3537 | |
| 3538 | dx1, dy1 = cos_t * dx + sin_t * dy, -sin_t * dx + cos_t * dy |
| 3539 | dx2, dy2 = cos_t * dx - sin_t * dy, sin_t * dx + cos_t * dy |
| 3540 | |
| 3541 | vertices_arrow = [(x1 + ddx + dx1, y1 + ddy + dy1), |
| 3542 | (x1 + ddx, y1 + ddy), |
| 3543 | (x1 + ddx + dx2, y1 + ddy + dy2)] |
| 3544 | codes_arrow = [Path.MOVETO, |
| 3545 | Path.LINETO, |
| 3546 | Path.LINETO] |
| 3547 | |
| 3548 | return vertices_arrow, codes_arrow, ddx, ddy |
| 3549 | |
| 3550 | def _get_bracket(self, x0, y0, |
| 3551 | x1, y1, width, length, angle): |