Aligns the family structure and data of this mobject with another mobject. Afterwards, the two mobjects will have the same number of submobjects (see :meth:`.align_submobjects`) and the same parent structure (see :meth:`.null_point_align`). If ``skip_point_alignment`` is ``F
(self, mobject: Mobject, skip_point_alignment: bool = False)
| 2879 | |
| 2880 | # Alignment |
| 2881 | def align_data(self, mobject: Mobject, skip_point_alignment: bool = False) -> None: |
| 2882 | """Aligns the family structure and data of this mobject with another mobject. |
| 2883 | |
| 2884 | Afterwards, the two mobjects will have the same number of submobjects |
| 2885 | (see :meth:`.align_submobjects`) and the same parent structure (see |
| 2886 | :meth:`.null_point_align`). If ``skip_point_alignment`` is ``False``, |
| 2887 | they will also have the same number of points (see :meth:`.align_points`). |
| 2888 | |
| 2889 | Parameters |
| 2890 | ---------- |
| 2891 | mobject |
| 2892 | The other mobject this mobject should be aligned to. |
| 2893 | skip_point_alignment |
| 2894 | Controls whether or not the computationally expensive |
| 2895 | point alignment is skipped (default: ``False``). |
| 2896 | |
| 2897 | |
| 2898 | .. note:: |
| 2899 | |
| 2900 | This method is primarily used internally by :meth:`.become` and the |
| 2901 | :class:`~.Transform` animation to ensure that mobjects are structurally |
| 2902 | compatible before transformation. |
| 2903 | |
| 2904 | Examples |
| 2905 | -------- |
| 2906 | :: |
| 2907 | |
| 2908 | >>> from manim import Rectangle, Line, ORIGIN, RIGHT |
| 2909 | >>> rect = Rectangle(width=4.0, height=2.0, grid_xstep=1.0, grid_ystep=0.5) |
| 2910 | >>> line = Line(start=ORIGIN,end=RIGHT) |
| 2911 | >>> line.align_data(rect) |
| 2912 | >>> len(line.get_family()) == len(rect.get_family()) |
| 2913 | True |
| 2914 | >>> line.get_num_points() == rect.get_num_points() |
| 2915 | True |
| 2916 | |
| 2917 | See also |
| 2918 | -------- |
| 2919 | :class:`~.Transform`, :meth:`~.Mobject.become`, :meth:`~.VMobject.align_points`, :meth:`~.Mobject.get_family` |
| 2920 | |
| 2921 | """ |
| 2922 | self.null_point_align(mobject) |
| 2923 | self.align_submobjects(mobject) |
| 2924 | if not skip_point_alignment: |
| 2925 | self.align_points(mobject) |
| 2926 | # Recurse |
| 2927 | for m1, m2 in zip(self.submobjects, mobject.submobjects, strict=True): |
| 2928 | m1.align_data(m2) |
| 2929 | |
| 2930 | def get_point_mobject(self, center=None): |
| 2931 | """The simplest :class:`~.Mobject` to be transformed to or from self. |
no test coverage detected