-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
maintenancerefactoring, typos, removing clutter/dead code, and other code quality improvementsrefactoring, typos, removing clutter/dead code, and other code quality improvementsrefactorRefactor or redesign of existing codeRefactor or redesign of existing code
Milestone
Description
manim/manim/mobject/svg/svg_mobject.py
Lines 499 to 524 in d3b96dd
def handle_commands(self) -> None: | |
segment_class_to_func_map = { | |
se.Move: (self.start_new_path, ("end",)), | |
se.Close: (self.close_path, ()), | |
se.Line: (self.add_line_to, ("end",)), | |
se.QuadraticBezier: ( | |
self.add_quadratic_bezier_curve_to, | |
("control", "end"), | |
), | |
se.CubicBezier: ( | |
self.add_cubic_bezier_curve_to, | |
("control1", "control2", "end"), | |
), | |
} | |
for segment in self.path_obj: | |
segment_class = segment.__class__ | |
func, attr_names = segment_class_to_func_map[segment_class] | |
points = [ | |
_convert_point_to_3d(*segment.__getattribute__(attr_name)) | |
for attr_name in attr_names | |
] | |
func(*points) | |
# Get rid of the side effect of trailing "Z M" commands. | |
if self.has_new_path_started(): | |
self.resize_points(self.get_num_points() - 1) |
This code is very confusing and i tested this with some if statements and there doesn't seem to be a performance difference. This issue is just to remind myself of commiting that code at some point.
Metadata
Metadata
Assignees
Labels
maintenancerefactoring, typos, removing clutter/dead code, and other code quality improvementsrefactoring, typos, removing clutter/dead code, and other code quality improvementsrefactorRefactor or redesign of existing codeRefactor or redesign of existing code
Type
Projects
Status
🆕 New