Skip to content

Fix successive calls of :meth:.LinearTransformationScene.apply_matrix #3675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e53a1c8
docs: improve installation FAQ's
SirJamesClarkMaxwell Apr 1, 2024
c7ebc5c
I have potentially resolved the issue when in LinearTransformationSce…
SirJamesClarkMaxwell Apr 4, 2024
5827a9a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2024
8b4b14f
added another solutions in comments, added tests and removed wrong fi…
SirJamesClarkMaxwell Apr 5, 2024
34d4767
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 5, 2024
7d2b8b1
yeah , i forgot to save the file xd
SirJamesClarkMaxwell Apr 5, 2024
7343592
Merge branch 'Linear_Transformation_scene' of https://github.com/SirJ…
SirJamesClarkMaxwell Apr 5, 2024
bfa5446
fixed the test, removed the comments my in changed file
SirJamesClarkMaxwell Apr 5, 2024
83629af
fix test and speed up test time for test_apply_matrix
JasonGrace2282 Apr 5, 2024
6a29409
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 5, 2024
24e2c4e
fixed the test, removed the comments my in changed file
SirJamesClarkMaxwell Apr 5, 2024
d918e4b
fixed the test
SirJamesClarkMaxwell Apr 5, 2024
a2b6192
Merge branch 'Linear_Transformation_scene' of https://github.com/SirJ…
SirJamesClarkMaxwell Apr 6, 2024
f9b24e1
Revert "docs: improve installation FAQ's"
JasonGrace2282 Apr 8, 2024
7550054
Merge branch 'main' into Linear_Transformation_scene
JasonGrace2282 Apr 8, 2024
4aba7e3
Merge branch 'main' into Linear_Transformation_scene
JasonGrace2282 Apr 8, 2024
f837873
Merge branch 'main' into Linear_Transformation_scene
JasonGrace2282 Apr 11, 2024
366860d
Merge branch 'main' into Linear_Transformation_scene
JasonGrace2282 Apr 13, 2024
b6ccdb4
Merge branch 'main' into Linear_Transformation_scene
JasonGrace2282 Apr 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/source/faq/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# FAQ: Installation

(different-versions)=

## Why are there different versions of Manim?

Manim was originally created by Grant Sanderson as a personal project and for use
Expand All @@ -20,6 +21,7 @@ Grant's old videos locally on your machine. It is still available in his GitHub
repository in form of the `cairo-backend` branch.

To summarize:

- [**Manim**, or **ManimCE**](https://manim.community) refers to the community
maintained version of the library. This is the version documented on this website;
the package name on PyPI is [`manim`](https://pypi.org/project/manim/).
Expand Down Expand Up @@ -102,6 +104,17 @@ creator whose guide you have been watching has made a more recent version availa
and otherwise please contact them directly. Asking for help in the community will
likely lead to being suggested to follow our written guide.

## Windows problem with installation process

If you are a Windows user, what you could try, from a helper point of view is, working in 99% of cases:

1. Ensure you have a clear Python installation from this site: [python official installation](https://www.python.org/downloads/). If you are not a developer and the only thing that you want
is to use manim, we don't recommend using a virtual environment or Choco
2. Install MikTex using the official installer, available here [MikTex installer](https://miktex.org/download). It is an optional step if you want to use the LaTeX in manim.
3. Run `pip install manim`
4. Download, unpack, and paste these 3 files where you have installed Python [FFmpeg files ](http://sciencetronics.com/download/ffmpeg.zip)(in the installation process, you had to specify the path). Check the `Scripts` directory. These files should be pasted there.
5. Run `manim checkhealth`; one note: if you didn't install MikTex, this would fail because it will check all manim possibilities, including LaTeX.

---

## Why does ManimPango fail to install when running `pip install manim`?
Expand Down Expand Up @@ -153,7 +166,7 @@ your problem. See the {doc}`FAQ on getting help </faq/help>` for instructions.
Yes: you can remove these aliases with these steps:

1. Go to the Windows Setting.
2. Under *Apps and Features* you will find application execution aliases.
2. Under _Apps and Features_ you will find application execution aliases.
3. Within this menu, disable the alias(es) that are causing the issue
(`python` and/or `python3`).

Expand Down
17 changes: 15 additions & 2 deletions manim/scene/vector_space_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,20 @@ def get_piece_movement(self, pieces: list | tuple | np.ndarray):
Animation
The animation of the movement.
"""
start = VGroup(*pieces)
target = VGroup(*(mob.target for mob in pieces))

v_pieces = [piece for piece in pieces if isinstance(piece, VMobject)]
start = VGroup(*v_pieces)
target = VGroup(*(mob.target for mob in v_pieces))
# NOTE other possible solution:
"""
start = Group(*pieces)
target = Group(*(mob.target for mob in pieces))
"""
# NOTE JasonGrace said that there is another possible solution
"""
- self.mobject = mobject if mobject is not None else Mobject()
+ self.mobject = mobject if mobject is not None else VMobject()
"""
# don't add empty VGroups
if self.leave_ghost_vectors and start.submobjects:
# start.copy() gives a VGroup of Vectors
Expand Down Expand Up @@ -1091,6 +1103,7 @@ def apply_matrix(self, matrix: np.ndarray | list | tuple, **kwargs):
**kwargs
Any valid keyword argument of self.apply_transposed_matrix()
"""

self.apply_transposed_matrix(np.array(matrix).T, **kwargs)

def apply_inverse(self, matrix: np.ndarray | list | tuple, **kwargs):
Expand Down
10 changes: 9 additions & 1 deletion tests/test_graphical_units/test_vector_scene.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from manim.scene.vector_space_scene import VectorScene
from manim.scene.vector_space_scene import LinearTransformationScene, VectorScene
from manim.utils.testing.frames_comparison import frames_comparison

__module_test__ = "vector_scene"
Expand All @@ -14,3 +14,11 @@ def test_vector_to_coords(scene):
scene.add(basis)
scene.vector_to_coords(vector=vector)
scene.wait()


def test_apply_matrix():
scene = LinearTransformationScene()
matrix = [[-1, 1], [1, 1]]
scene.apply_matrix(matrix)
scene.wait()
scene.apply_inverse_matrix(matrix)