Fix Line
failing with buff
and path_arc
#4193
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview: What does this pull request change?
Fixes issue: #4132
Motivation and Explanation: Why and how do your changes improve the library?
Issue Explanation
When
buff
is given,Line
internally callspointwise_become_partial
, passingself
as the argument forvmobject
:In Manim v0.19.0, the
pointwise_become_partial
code was modified in commit374eeeba
(from PR #3760). This change introduced the issue.Initially (in my first commit), I addressed this issue by modifying
pointwise_become_partial
so that it creates a copy ofvmobject.points
ifvmobject
isself
, avoiding in-place modification ofvmobject.points
whenself.points
is set tonp.empty(...)
. Making a copy is essential becauseself.points
andvmobject.points
are used together afterself.points
is set tonp.empty(...)
. See the related source code.However, I realized that a simpler solution exists which avoids modifying
pointwise_become_partial
. Instead, the issue can be resolved by adjusting howLine
uses it: When calling it, instead of passingvmobject=self
, we should passvmobject=self.copy()
. I’ve implemented this in my most recent commit.Reviewer Checklist