mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 05:24:22 +08:00
Revert "Revert back from the needs_new_unit_normal change in favor of recomputation"
This reverts commit d8deec8f813166b9bf42960acb0f6da4349712e7.
This commit is contained in:
@ -100,6 +100,7 @@ class VMobject(Mobject):
|
|||||||
self.flat_stroke = flat_stroke
|
self.flat_stroke = flat_stroke
|
||||||
|
|
||||||
self.needs_new_triangulation = True
|
self.needs_new_triangulation = True
|
||||||
|
self.needs_new_unit_normal = True
|
||||||
self.triangulation = np.zeros(0, dtype='i4')
|
self.triangulation = np.zeros(0, dtype='i4')
|
||||||
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
@ -771,7 +772,7 @@ class VMobject(Mobject):
|
|||||||
])
|
])
|
||||||
|
|
||||||
def get_unit_normal(self, recompute: bool = False) -> Vect3:
|
def get_unit_normal(self, recompute: bool = False) -> Vect3:
|
||||||
if not recompute:
|
if not self.needs_new_unit_normal and not recompute:
|
||||||
return self.data["unit_normal"][0]
|
return self.data["unit_normal"][0]
|
||||||
|
|
||||||
if self.get_num_points() < 3:
|
if self.get_num_points() < 3:
|
||||||
@ -788,11 +789,12 @@ class VMobject(Mobject):
|
|||||||
points[2] - points[1],
|
points[2] - points[1],
|
||||||
)
|
)
|
||||||
self.data["unit_normal"][:] = normal
|
self.data["unit_normal"][:] = normal
|
||||||
|
self.needs_new_unit_normal = False
|
||||||
return normal
|
return normal
|
||||||
|
|
||||||
def refresh_unit_normal(self):
|
def refresh_unit_normal(self):
|
||||||
for mob in self.get_family():
|
for mob in self.get_family():
|
||||||
mob.get_unit_normal(recompute=True)
|
mob.needs_new_unit_normal = True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
# Alignment
|
# Alignment
|
||||||
|
Reference in New Issue
Block a user