(self, path, mutation_size, linewidth)
| 3574 | return vertices_arrow, codes_arrow |
| 3575 | |
| 3576 | def transmute(self, path, mutation_size, linewidth): |
| 3577 | # docstring inherited |
| 3578 | if self._beginarrow_head or self._endarrow_head: |
| 3579 | head_length = self.head_length * mutation_size |
| 3580 | head_width = self.head_width * mutation_size |
| 3581 | head_dist = np.hypot(head_length, head_width) |
| 3582 | cos_t, sin_t = head_length / head_dist, head_width / head_dist |
| 3583 | |
| 3584 | scaleA = mutation_size if self.scaleA is None else self.scaleA |
| 3585 | scaleB = mutation_size if self.scaleB is None else self.scaleB |
| 3586 | |
| 3587 | # begin arrow |
| 3588 | x0, y0 = path.vertices[0] |
| 3589 | x1, y1 = path.vertices[1] |
| 3590 | |
| 3591 | # If there is no room for an arrow and a line, then skip the arrow |
| 3592 | has_begin_arrow = self._beginarrow_head and (x0, y0) != (x1, y1) |
| 3593 | verticesA, codesA, ddxA, ddyA = ( |
| 3594 | self._get_arrow_wedge(x1, y1, x0, y0, |
| 3595 | head_dist, cos_t, sin_t, linewidth) |
| 3596 | if has_begin_arrow |
| 3597 | else ([], [], 0, 0) |
| 3598 | ) |
| 3599 | |
| 3600 | # end arrow |
| 3601 | x2, y2 = path.vertices[-2] |
| 3602 | x3, y3 = path.vertices[-1] |
| 3603 | |
| 3604 | # If there is no room for an arrow and a line, then skip the arrow |
| 3605 | has_end_arrow = self._endarrow_head and (x2, y2) != (x3, y3) |
| 3606 | verticesB, codesB, ddxB, ddyB = ( |
| 3607 | self._get_arrow_wedge(x2, y2, x3, y3, |
| 3608 | head_dist, cos_t, sin_t, linewidth) |
| 3609 | if has_end_arrow |
| 3610 | else ([], [], 0, 0) |
| 3611 | ) |
| 3612 | |
| 3613 | # This simple code will not work if ddx, ddy is greater than the |
| 3614 | # separation between vertices. |
| 3615 | paths = [Path(np.concatenate([[(x0 + ddxA, y0 + ddyA)], |
| 3616 | path.vertices[1:-1], |
| 3617 | [(x3 + ddxB, y3 + ddyB)]]), |
| 3618 | path.codes)] |
| 3619 | fills = [False] |
| 3620 | |
| 3621 | if has_begin_arrow: |
| 3622 | if self.fillbegin: |
| 3623 | paths.append( |
| 3624 | Path([*verticesA, (0, 0)], [*codesA, Path.CLOSEPOLY])) |
| 3625 | fills.append(True) |
| 3626 | else: |
| 3627 | paths.append(Path(verticesA, codesA)) |
| 3628 | fills.append(False) |
| 3629 | elif self._beginarrow_bracket: |
| 3630 | x0, y0 = path.vertices[0] |
| 3631 | x1, y1 = path.vertices[1] |
| 3632 | verticesA, codesA = self._get_bracket(x0, y0, x1, y1, |
| 3633 | self.widthA * scaleA, |
nothing calls this directly
no test coverage detected