Remove some references to triangulation

This commit is contained in:
Grant Sanderson 2023-01-28 12:43:56 -08:00
parent 144e512952
commit 8d72340501
5 changed files with 10 additions and 14 deletions

View file

@ -136,7 +136,6 @@ class DrawBorderThenFill(Animation):
if index == 1 and self.sm_to_index[hash(submob)] == 0:
# First time crossing over
submob.set_data(outline.data)
submob.needs_new_triangulation = False
self.sm_to_index[hash(submob)] = 1
if index == 0:

View file

@ -448,12 +448,8 @@ class Annulus(VMobject):
)
self.radius = outer_radius
# Make sure to add enough components that triangulation doesn't fail
kw = dict(
n_components=int(max(8, np.ceil(TAU / math.acos(inner_radius / outer_radius))))
)
outer_path = outer_radius * Arc.create_quadratic_bezier_points(TAU, 0, **kw)
inner_path = inner_radius * Arc.create_quadratic_bezier_points(-TAU, 0, **kw)
outer_path = outer_radius * Arc.create_quadratic_bezier_points(TAU, 0)
inner_path = inner_radius * Arc.create_quadratic_bezier_points(-TAU, 0)
self.add_subpath(outer_path)
self.add_subpath(inner_path)
self.shift(center)

View file

@ -383,7 +383,6 @@ class Bubble(SVGMobject):
self.flip()
self.content = Mobject()
self.refresh_triangulation()
def get_tip(self):
# TODO, find a better way

View file

@ -319,8 +319,6 @@ class VMobjectFromSVGPath(VMobject):
if self.should_remove_null_curves:
# Get rid of any null curves
self.set_points(self.get_points_without_null_curves())
# So triangulation doesn't get messed up
self.subdivide_intersections()
# Save for future use
PATH_TO_POINTS[path_string] = self.get_points().copy()
else:

View file

@ -459,6 +459,8 @@ class VMobject(Mobject):
def use_winding_fill(self, value: bool = True, recurse: bool = True):
for submob in self.get_family(recurse):
submob._use_winding_fill = value
if not value:
submob.subdivide_intersections()
return self
# Points
@ -899,8 +901,11 @@ class VMobject(Mobject):
# If both have fill, and they have the same shape, just
# give them the same triangulation so that it's not recalculated
# needlessly throughout an animation
if not self._use_winding_fill and self.has_fill() \
and vmobject.has_fill() and self.has_same_shape_as(vmobject):
match_tris = not self._use_winding_fill and \
self.has_fill() and \
vmobject.has_fill() and \
self.has_same_shape_as(vmobject)
if match_tris:
vmobject.triangulation = self.triangulation
return self
@ -921,8 +926,7 @@ class VMobject(Mobject):
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]] * 3
return [path_list[-1][-1]]
return path_list[n]
for n in range(n_subpaths):