forked from ManimCommunity/manim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow accessing ghost vectors in :class:
.LinearTransformationScene
(M…
…animCommunity#3435) * Fix CSV reader adding empty files Fixes issue ManimCommunity#3311 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Added LinearTransformationScene.ghost_vectors * Added test and prevented empty VGroups as ghost vectors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed typo in example * Added ability to join together multiple renders * Revert "Added ability to join together multiple renders" (wrong branch) This reverts commit dee29c3. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from manim import RIGHT, UP, LinearTransformationScene, Vector, VGroup | ||
|
||
__module_test__ = "vector_space_scene" | ||
|
||
|
||
def test_ghost_vectors_len_and_types(): | ||
scene = LinearTransformationScene() | ||
scene.leave_ghost_vectors = True | ||
|
||
# prepare vectors (they require a vmobject as their target) | ||
v1, v2 = Vector(RIGHT), Vector(RIGHT) | ||
v1.target, v2.target = Vector(UP), Vector(UP) | ||
|
||
# ghost_vector addition is in this method | ||
scene.get_piece_movement((v1, v2)) | ||
|
||
ghosts = scene.get_ghost_vectors() | ||
assert len(ghosts) == 1 | ||
# check if there are two vectors in the ghost vector VGroup | ||
assert len(ghosts[0]) == 2 | ||
|
||
# check types of ghost vectors | ||
assert isinstance(ghosts, VGroup) and isinstance(ghosts[0], VGroup) | ||
assert all(isinstance(x, Vector) for x in ghosts[0]) |