manim
manim copied to clipboard
Improve line rendering performance by decreasing redundant subdivision count
Subdividing a cylinder by its height adds no extra resolution - all new rectangles would look the same as one long rectangle. Decreasing the default subdivision resolution to 2 reduces submobject count by 12x while sacrificing no quality.
Overview: What does this pull request change?
Decrease default cylinder height resolution to 2
Motivation and Explanation: Why and how do your changes improve the library?
I was rendering a 3D scene with a bunch of lines and initializing them took a very long time. I then noticed that lines (and cylinders in general) are subdivided to 24 rectangles by the height, not only the radius. This is wasteful because cylinders are straight - 24 small rectangles on one face of the cylinder will look identical to one long rectangle. Reducing the height resolution to 2 improves performance and submobject count 12x while sacrificing no quality at all.
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist
- [ ] The PR title is descriptive enough for the changelog, and the PR is labeled correctly
- [ ] If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
- [ ] If applicable: newly added functions and classes are tested