mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Make sure triangulation is remembered correctly
This commit is contained in:
parent
25c5aa2c65
commit
ca9b70e218
1 changed files with 5 additions and 2 deletions
|
@ -88,10 +88,10 @@ class SVGMobject(VMobject):
|
||||||
elif element.tagName == 'style':
|
elif element.tagName == 'style':
|
||||||
pass # TODO, handle style
|
pass # TODO, handle style
|
||||||
elif element.tagName in ['g', 'svg', 'symbol']:
|
elif element.tagName in ['g', 'svg', 'symbol']:
|
||||||
result += it.chain(*[
|
result += it.chain(*(
|
||||||
self.get_mobjects_from(child)
|
self.get_mobjects_from(child)
|
||||||
for child in element.childNodes
|
for child in element.childNodes
|
||||||
])
|
))
|
||||||
elif element.tagName == 'path':
|
elif element.tagName == 'path':
|
||||||
result.append(self.path_string_to_mobject(
|
result.append(self.path_string_to_mobject(
|
||||||
element.getAttribute('d')
|
element.getAttribute('d')
|
||||||
|
@ -341,6 +341,8 @@ class VMobjectFromSVGPathstring(VMobject):
|
||||||
|
|
||||||
if os.path.exists(points_filepath) and os.path.exists(tris_filepath):
|
if os.path.exists(points_filepath) and os.path.exists(tris_filepath):
|
||||||
self.set_points(np.load(points_filepath))
|
self.set_points(np.load(points_filepath))
|
||||||
|
self.triangulation = np.load(tris_filepath)
|
||||||
|
self.needs_new_triangulation = False
|
||||||
else:
|
else:
|
||||||
self.relative_point = np.array(ORIGIN)
|
self.relative_point = np.array(ORIGIN)
|
||||||
for command, coord_string in self.get_commands_and_coord_strings():
|
for command, coord_string in self.get_commands_and_coord_strings():
|
||||||
|
@ -356,6 +358,7 @@ class VMobjectFromSVGPathstring(VMobject):
|
||||||
self.stretch(-1, 1, about_point=ORIGIN)
|
self.stretch(-1, 1, about_point=ORIGIN)
|
||||||
# Save to a file for future use
|
# Save to a file for future use
|
||||||
np.save(points_filepath, self.get_points())
|
np.save(points_filepath, self.get_points())
|
||||||
|
np.save(tris_filepath, self.get_triangulation())
|
||||||
|
|
||||||
def get_commands_and_coord_strings(self):
|
def get_commands_and_coord_strings(self):
|
||||||
all_commands = list(self.get_command_to_function_map().keys())
|
all_commands = list(self.get_command_to_function_map().keys())
|
||||||
|
|
Loading…
Add table
Reference in a new issue