Repository navigation
Sphere: do not rewrite Sphere[] and Sphere[p]; fill in defaults when drawing - #1995
Open
tombouctou wants to merge 1 commit into
Open
tombouctou wants to merge 1 commit into
tombouctou wants to merge 1 commit into
Conversation
…drawing
In WMA Sphere[c] is an inert symbolic primitive: it stays Sphere[c] and
the default radius 1 is only used when it is rendered. Mathics3 rewrote
Sphere[c] to Sphere[c, 1] (and Sphere[] to Sphere[{0, 0, 0}, 1]) with
rules that cannot be cleared, so packages that use Sphere[n] as an inert
head (e.g. Sphere[7] for S^7) break.
SphereBox now accepts 0, 1 or 2 arguments and fills in the default
center and radius itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In WMA,
Sphereis a symbolic graphics primitive that does not evaluate:Sphere[{1, 2, 3}]staysSphere[{1, 2, 3}], and the default radius 1 (and the default center forSphere[]) is only used when the sphere is drawn.Mathics3 rewrote
Sphere[p]toSphere[p, 1]andSphere[]toSphere[{0, 0, 0}, 1]with builtin rules thatClearcannot remove. This breaks code that usesSphere[n]as an inert head, e.g. a package whereSphere[7]stands for the 7-sphere and definitions such asf[Sphere[n_]] := ...must match:This PR removes the two rules and lets
SphereBoxaccept 0, 1 or 2 arguments, filling in the defaults itself. The Asymptote output forGraphics3D[Sphere[]]is unchanged (existing doctest andtest_plotcase).Tests: new cases in
test/builtin/drawing/test_plot.pyand a doctest inSphere.🤖 Generated with Claude Code