Skip to content
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

Fix numpy reshape error in opengl_vectorized_mobject for transforming mobjects with different number of subpaths #3278

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion manim/mobject/opengl/opengl_vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def align_points(self, vmobject):
def get_nth_subpath(path_list, n):
if n >= len(path_list):
# Create a null path at the very end
return [path_list[-1][-1]] * nppc
return np.array([path_list[-1][-1]] * nppc)
path = path_list[n]
# Check for useless points at the end of the path and remove them
# https://github.com/ManimCommunity/manim/issues/1959
Expand Down
10 changes: 9 additions & 1 deletion tests/opengl/test_opengl_vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pytest

from manim import Circle, Line, Square, VDict, VGroup
from manim import Circle, Line, Square, Text, VDict, VGroup
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject

Expand Down Expand Up @@ -32,6 +32,14 @@ def test_opengl_vmobject_point_from_propotion(using_opengl_renderer):
obj.point_from_proportion(0)


def test_opengl_align_family_and_data(using_opengl_renderer):
text_c = Text("c")
text_o = Text("o")
assert text_c.get_all_points().shape != text_o.get_all_points().shape
text_c.align_data_and_family(text_o)
assert text_c.get_all_points().shape == text_o.get_all_points().shape


def test_vgroup_init(using_opengl_renderer):
"""Test the VGroup instantiation."""
VGroup()
Expand Down