mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Remove some references to triangulation
This commit is contained in:
parent
144e512952
commit
8d72340501
5 changed files with 10 additions and 14 deletions
|
@ -136,7 +136,6 @@ class DrawBorderThenFill(Animation):
|
||||||
if index == 1 and self.sm_to_index[hash(submob)] == 0:
|
if index == 1 and self.sm_to_index[hash(submob)] == 0:
|
||||||
# First time crossing over
|
# First time crossing over
|
||||||
submob.set_data(outline.data)
|
submob.set_data(outline.data)
|
||||||
submob.needs_new_triangulation = False
|
|
||||||
self.sm_to_index[hash(submob)] = 1
|
self.sm_to_index[hash(submob)] = 1
|
||||||
|
|
||||||
if index == 0:
|
if index == 0:
|
||||||
|
|
|
@ -448,12 +448,8 @@ class Annulus(VMobject):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.radius = outer_radius
|
self.radius = outer_radius
|
||||||
# Make sure to add enough components that triangulation doesn't fail
|
outer_path = outer_radius * Arc.create_quadratic_bezier_points(TAU, 0)
|
||||||
kw = dict(
|
inner_path = inner_radius * Arc.create_quadratic_bezier_points(-TAU, 0)
|
||||||
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)
|
|
||||||
self.add_subpath(outer_path)
|
self.add_subpath(outer_path)
|
||||||
self.add_subpath(inner_path)
|
self.add_subpath(inner_path)
|
||||||
self.shift(center)
|
self.shift(center)
|
||||||
|
|
|
@ -383,7 +383,6 @@ class Bubble(SVGMobject):
|
||||||
self.flip()
|
self.flip()
|
||||||
|
|
||||||
self.content = Mobject()
|
self.content = Mobject()
|
||||||
self.refresh_triangulation()
|
|
||||||
|
|
||||||
def get_tip(self):
|
def get_tip(self):
|
||||||
# TODO, find a better way
|
# TODO, find a better way
|
||||||
|
|
|
@ -319,8 +319,6 @@ class VMobjectFromSVGPath(VMobject):
|
||||||
if self.should_remove_null_curves:
|
if self.should_remove_null_curves:
|
||||||
# Get rid of any null curves
|
# Get rid of any null curves
|
||||||
self.set_points(self.get_points_without_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
|
# Save for future use
|
||||||
PATH_TO_POINTS[path_string] = self.get_points().copy()
|
PATH_TO_POINTS[path_string] = self.get_points().copy()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -459,6 +459,8 @@ class VMobject(Mobject):
|
||||||
def use_winding_fill(self, value: bool = True, recurse: bool = True):
|
def use_winding_fill(self, value: bool = True, recurse: bool = True):
|
||||||
for submob in self.get_family(recurse):
|
for submob in self.get_family(recurse):
|
||||||
submob._use_winding_fill = value
|
submob._use_winding_fill = value
|
||||||
|
if not value:
|
||||||
|
submob.subdivide_intersections()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
# Points
|
# Points
|
||||||
|
@ -899,8 +901,11 @@ class VMobject(Mobject):
|
||||||
# If both have fill, and they have the same shape, just
|
# If both have fill, and they have the same shape, just
|
||||||
# give them the same triangulation so that it's not recalculated
|
# give them the same triangulation so that it's not recalculated
|
||||||
# needlessly throughout an animation
|
# needlessly throughout an animation
|
||||||
if not self._use_winding_fill and self.has_fill() \
|
match_tris = not self._use_winding_fill and \
|
||||||
and vmobject.has_fill() and self.has_same_shape_as(vmobject):
|
self.has_fill() and \
|
||||||
|
vmobject.has_fill() and \
|
||||||
|
self.has_same_shape_as(vmobject)
|
||||||
|
if match_tris:
|
||||||
vmobject.triangulation = self.triangulation
|
vmobject.triangulation = self.triangulation
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -921,8 +926,7 @@ class VMobject(Mobject):
|
||||||
|
|
||||||
def get_nth_subpath(path_list, n):
|
def get_nth_subpath(path_list, n):
|
||||||
if n >= len(path_list):
|
if n >= len(path_list):
|
||||||
# Create a null path at the very end
|
return [path_list[-1][-1]]
|
||||||
return [path_list[-1][-1]] * 3
|
|
||||||
return path_list[n]
|
return path_list[n]
|
||||||
|
|
||||||
for n in range(n_subpaths):
|
for n in range(n_subpaths):
|
||||||
|
|
Loading…
Add table
Reference in a new issue