refactor: rename Torus field 'r' to 'minor_radius' for clarity #4461
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?
This pull request refactors the
Torusclass inmanim/mobject/three_d/three_dimensions.pyby renaming the fieldself.rtoself.minor_radius. This change improves code clarity and reduces potential confusion with theself.R(major_radius) field. All internal usages of the field have been updated accordingly.Torusclass by renaming the ambiguousself.rattribute toself.minor_radius.Motivation and Explanation: Why and how do your changes improve the library?
The motivation for this change is to enhance code quality and maintainability.
self.rwas used to represent the minor radius of the torus, whileself.Rrepresents the major radius. The minimal visual difference betweenrandRcan easily lead to misinterpretation, bugs, and confusion, especially for new contributors.self.rto the more descriptiveself.minor_radiusmakes the purpose of the field immediately clear, which simplifies future maintenance and development.The change was implemented by renaming the attribute and using refactoring to update all its occurrences within the
Torusclass, ensuring functionality remains identical.Links to added or changed documentation pages
This change primarily affects the internal implementation of the
Torusclass. The docstrings withinmanim/mobject/three_d/three_dimensions.pyhave been reviewed to ensure they reflect the new attribute name. No public-facing documentation pages were directly affected.Further Information and Comments
The field
self.rin theTorusclass has been renamed toself.minor_radius, and all usages within the class have been updated. The implementation was verified against related test files, and no regressions were found. The code is now more maintainable and aligns with best practices for clear naming conventions.Reviewer Checklist
this PR should solve #4271