mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fix the but for transforming between VMobjects with different triangulations. Turns out this is all that's needed
This commit is contained in:
parent
baff788217
commit
156ea11537
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||||
from manimlib.utils.iterables import stretch_array_to_length_with_interpolation
|
from manimlib.utils.iterables import stretch_array_to_length_with_interpolation
|
||||||
from manimlib.utils.iterables import listify
|
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 angle_between_vectors
|
||||||
from manimlib.utils.space_ops import cross2d
|
from manimlib.utils.space_ops import cross2d
|
||||||
from manimlib.utils.space_ops import earclip_triangulation
|
from manimlib.utils.space_ops import earclip_triangulation
|
||||||
|
@ -883,6 +884,12 @@ class VMobject(Mobject):
|
||||||
vmob.pointwise_become_partial(self, a, b)
|
vmob.pointwise_become_partial(self, a, b)
|
||||||
return vmob
|
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
|
# For shaders
|
||||||
def init_shader_data(self):
|
def init_shader_data(self):
|
||||||
self.fill_data = np.zeros(len(self.points), dtype=self.fill_dtype)
|
self.fill_data = np.zeros(len(self.points), dtype=self.fill_dtype)
|
||||||
|
|
Loading…
Add table
Reference in a new issue