Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Line failing with buff and path_arc #4193

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

irvanalhaq9
Copy link
Contributor

@irvanalhaq9 irvanalhaq9 commented Mar 17, 2025

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 calls pointwise_become_partial, passing self as the argument for vmobject:

self.pointwise_become_partial(vmobject=self, a=buff_proportion, b=1 - buff_proportion)

In Manim v0.19.0, the pointwise_become_partial code was modified in commit 374eeeba (from PR #3760). This change introduced the issue.

Initially, this PR focused on modifying the pointwise_become_partial code by making a copy of vmobject.points if vmobject is self to avoid in-place modification of vmobject.points when self.points is set to np.empty(...). Making a copy is essential because self.points and vmobject.points are used together. See the related source code.

However, I found a simpler solution that does not require changing pointwise_become_partial. Instead, the issue can be resolved by adjusting how Line uses it:

When calling it, instead of passing vmobject=self, we should pass vmobject=self.copy().

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

@irvanalhaq9 irvanalhaq9 changed the title Fix Line failing with buff and path_arc (issue #4132) Fix Line failing with buff and path_arc Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant