Skip to content

Fix 3D ellipsoid scaling around its center - #4978

Merged
FlorianPfaff merged 2 commits into
mainfrom
agent/fix-3d-ellipsoid-scaling
Aug 3, 2026
Merged

Fix 3D ellipsoid scaling around its center#4978
FlorianPfaff merged 2 commits into
mainfrom
agent/fix-3d-ellipsoid-scaling

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

plot_ellipsoid_3d() applied scaling_factor to the already translated surface coordinates. For an ellipsoid centered away from the origin, changing its scale therefore moved the center as well as resizing the axes.

For example, an identity ellipsoid centered at [3, 4, 5] with scaling_factor=2 produced a vertical extent from 8 to 12, centered at 10, instead of the correct extent from 3 to 7, centered at 5.

Root cause

The helper first added center to the unit-sphere transform and then multiplied x, y, and z by scaling_factor in plot_surface(). Algebraically, this computed scale * (shape @ point + center) rather than center + scale * shape @ point.

Fix

  • apply scaling_factor only to the transformed ellipsoid offsets;
  • translate by center afterward;
  • pass the final world coordinates directly to Matplotlib;
  • add a regression using a non-origin center and a scale factor of two.

Validation

  • the regression fails against the previous implementation with z=12 where z=7 is expected;
  • the focused regression passes with the patch;
  • syntax compilation passes for both the modified implementation and the new test;
  • branch is 2 commits ahead and 0 behind main, with changes limited to the plotting helper and one regression test.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 23.54s
✅ JSON prettier 7 0 0 0 1.45s
✅ JSON v8r 7 0 0 3.84s
✅ MARKDOWN markdownlint 68 0 0 0 1.86s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.9s
✅ PYTHON black 1810 56 0 0 84.56s
✅ PYTHON isort 1810 88 0 0 2.74s
✅ REPOSITORY betterleaks yes no no 1.57s
✅ REPOSITORY checkov yes no no 52.52s
✅ REPOSITORY gitleaks yes no no 15.66s
✅ REPOSITORY git_diff yes no no 0.11s
✅ REPOSITORY secretlint yes no no 78.68s
✅ REPOSITORY syft yes no no 5.37s
✅ REPOSITORY trivy-sbom yes no no 6.32s
✅ REPOSITORY trufflehog yes no no 31.84s
✅ YAML prettier 11 0 0 0 0.79s
✅ YAML v8r 11 0 0 12.04s
✅ YAML yamllint 11 0 0 0.53s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review August 3, 2026 08:44
@FlorianPfaff
FlorianPfaff merged commit 1e092d5 into main Aug 3, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant