Fix the but for transforming between VMobjects with different triangulations. Turns out this is all that's needed

This commit is contained in:
Grant Sanderson
2021-01-03 17:17:20 -08:00
parent baff788217
commit 156ea11537

View File

@ -22,6 +22,7 @@ from manimlib.utils.iterables import make_even
from manimlib.utils.iterables import stretch_array_to_length
from manimlib.utils.iterables import stretch_array_to_length_with_interpolation
from manimlib.utils.iterables import listify
from manimlib.utils.paths import straight_path
from manimlib.utils.space_ops import angle_between_vectors
from manimlib.utils.space_ops import cross2d
from manimlib.utils.space_ops import earclip_triangulation
@ -883,6 +884,12 @@ class VMobject(Mobject):
vmob.pointwise_become_partial(self, a, b)
return vmob
def interpolate(self, mobject1, mobject2, alpha, path_func=straight_path):
super().interpolate(mobject1, mobject2, alpha, path_func)
if not np.all(mobject1.get_triangulation() == mobject2.get_triangulation()):
self.refresh_triangulation()
return self
# For shaders
def init_shader_data(self):
self.fill_data = np.zeros(len(self.points), dtype=self.fill_dtype)