A `TransformedPath` caches a non-affine transformed copy of the `~.path.Path`. This cached copy is automatically updated when the non-affine part of the transform changes. .. note:: Paths are considered immutable by this class. Any update to the path's vertices/co
| 2776 | |
| 2777 | |
| 2778 | class TransformedPath(TransformNode): |
| 2779 | """ |
| 2780 | A `TransformedPath` caches a non-affine transformed copy of the |
| 2781 | `~.path.Path`. This cached copy is automatically updated when the |
| 2782 | non-affine part of the transform changes. |
| 2783 | |
| 2784 | .. note:: |
| 2785 | |
| 2786 | Paths are considered immutable by this class. Any update to the |
| 2787 | path's vertices/codes will not trigger a transform recomputation. |
| 2788 | |
| 2789 | """ |
| 2790 | def __init__(self, path, transform): |
| 2791 | """ |
| 2792 | Parameters |
| 2793 | ---------- |
| 2794 | path : `~.path.Path` |
| 2795 | transform : `Transform` |
| 2796 | """ |
| 2797 | _api.check_isinstance(Transform, transform=transform) |
| 2798 | super().__init__() |
| 2799 | self._path = path |
| 2800 | self._transform = transform |
| 2801 | self.set_children(transform) |
| 2802 | self._transformed_path = None |
| 2803 | self._transformed_points = None |
| 2804 | |
| 2805 | def _revalidate(self): |
| 2806 | # only recompute if the invalidation includes the non_affine part of |
| 2807 | # the transform |
| 2808 | if (self._invalid == self._INVALID_FULL |
| 2809 | or self._transformed_path is None): |
| 2810 | self._transformed_path = \ |
| 2811 | self._transform.transform_path_non_affine(self._path) |
| 2812 | self._transformed_points = \ |
| 2813 | Path._fast_from_codes_and_verts( |
| 2814 | self._transform.transform_non_affine(self._path.vertices), |
| 2815 | None, self._path) |
| 2816 | self._invalid = 0 |
| 2817 | |
| 2818 | def get_transformed_points_and_affine(self): |
| 2819 | """ |
| 2820 | Return a copy of the child path, with the non-affine part of |
| 2821 | the transform already applied, along with the affine part of |
| 2822 | the path necessary to complete the transformation. Unlike |
| 2823 | :meth:`get_transformed_path_and_affine`, no interpolation will |
| 2824 | be performed. |
| 2825 | """ |
| 2826 | self._revalidate() |
| 2827 | return self._transformed_points, self.get_affine() |
| 2828 | |
| 2829 | def get_transformed_path_and_affine(self): |
| 2830 | """ |
| 2831 | Return a copy of the child path, with the non-affine part of |
| 2832 | the transform already applied, along with the affine part of |
| 2833 | the path necessary to complete the transformation. |
| 2834 | """ |
| 2835 | self._revalidate() |
no outgoing calls
no test coverage detected
searching dependent graphs…