More fractal additions

This commit is contained in:
Grant Sanderson
2017-01-17 17:14:32 -08:00
parent 0835d52bb4
commit b0e53b8f2a
3 changed files with 296 additions and 15 deletions

View File

@ -62,6 +62,8 @@ class SVGMobject(VMobject):
result.append(self.rect_to_mobject(element))
elif element.tagName == 'circle':
result.append(self.circle_to_mobject(element))
elif element.tagName == 'polygon':
result.append(self.polygon_to_mobject(element))
else:
warnings.warn("Unknown element type: " + element.tagName)
result = filter(lambda m : m is not None, result)
@ -86,6 +88,14 @@ class SVGMobject(VMobject):
self.ref_to_element[ref]
)
def polygon_to_mobject(self, polygon_element):
#TODO, This seems hacky...
path_string = polygon_element.getAttribute("points")
for digit in string.digits:
path_string = path_string.replace(" " + digit, " L" + digit)
path_string = "M" + path_string
return self.path_string_to_mobject(path_string)
# <circle class="st1" cx="143.8" cy="268" r="22.6"/>
def circle_to_mobject(self, circle_element):