(self, x0, y0, width, height, mutation_size)
| 2668 | # Modified from RArrow to have arrows on both sides; see comments above. |
| 2669 | |
| 2670 | def __call__(self, x0, y0, width, height, mutation_size): |
| 2671 | # padding & padded dimensions |
| 2672 | pad = mutation_size * self.pad |
| 2673 | dx, dy = width + 2 * pad, height + 2 * pad |
| 2674 | x0, y0 = x0 - pad, y0 - pad, |
| 2675 | x1, y1 = x0 + dx, y0 + dy |
| 2676 | |
| 2677 | head_dy = self.head_width * dy |
| 2678 | mid_y = (y0 + y1) / 2 |
| 2679 | shaft_y0 = mid_y - head_dy / 2 |
| 2680 | shaft_y1 = mid_y + head_dy / 2 |
| 2681 | |
| 2682 | cot = 1 / math.tan(math.radians(self.head_angle / 2)) |
| 2683 | |
| 2684 | if cot > 0: |
| 2685 | tip_x0 = x0 - cot * min(dy, head_dy) / 2 |
| 2686 | shaft_x0 = tip_x0 + cot * head_dy / 2 |
| 2687 | tip_x1 = x1 + cot * min(dy, head_dy) / 2 |
| 2688 | shaft_x1 = tip_x1 - cot * head_dy / 2 |
| 2689 | return Path._create_closed([ |
| 2690 | (shaft_x0, y1), (shaft_x0, shaft_y1), |
| 2691 | (tip_x0, mid_y), |
| 2692 | (shaft_x0, shaft_y0), (shaft_x0, y0), |
| 2693 | (shaft_x1, y0), (shaft_x1, shaft_y0), |
| 2694 | (tip_x1, mid_y), |
| 2695 | (shaft_x1, shaft_y1), (shaft_x1, y1), |
| 2696 | ]) |
| 2697 | else: |
| 2698 | # Don't move back by more than half the box length. |
| 2699 | dx = min(-cot * max(head_dy - dy, 0) / 2, dx / 2) # cot < 0! |
| 2700 | mid_y0 = min(shaft_y0, y0) - dx / cot |
| 2701 | mid_y1 = max(shaft_y1, y1) + dx / cot |
| 2702 | return Path._create_closed([ |
| 2703 | (x0, shaft_y0), (x0 + dx, mid_y0), |
| 2704 | (x1 - dx, mid_y0), (x1, shaft_y0), |
| 2705 | (x1, shaft_y1), (x1 - dx, mid_y1), |
| 2706 | (x0 + dx, mid_y1), (x0, shaft_y1), |
| 2707 | ]) |
| 2708 | |
| 2709 | @_register_style(_style_list) |
| 2710 | class Round: |
nothing calls this directly
no test coverage detected