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

Code example for Sphere is misleading #3948

Open
0x13b opened this issue Oct 5, 2024 · 2 comments · May be fixed by #3973
Open

Code example for Sphere is misleading #3948

0x13b opened this issue Oct 5, 2024 · 2 comments · May be fixed by #3973

Comments

@0x13b
Copy link

0x13b commented Oct 5, 2024

Description of bug / unexpected behavior

The corresponding 3d shading of sphere1 in the Figure of ExampleSphere looks inconsistent. This is because of confused ranges u_range and v_range in the initialization of sphere1.

Expected behavior

Shading of sphere1 should look smoothly, e.g. as for sphere2 in the Figure of ExampleSphere.

How to reproduce the issue

This is just a copy-pasted snippet of code from docs with my comments for u_range and v_range.

Code for reproducing the problem
from manim import *

class ExampleSphere(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=PI / 6, theta=PI / 6)
        sphere1 = Sphere(
            center=(3, 0, 0),
            radius=1,
            resolution=(20, 20),
            #
            ## u_range and v_range looks confused
            #
            u_range=[0.001, PI - 0.001],  # should be [0.001, TAU - 0.001], or better [0, TAU]
            v_range=[0, TAU]  # should be [0, PI]
        )  # bad shading
        sphere1.set_color(RED)
        self.add(sphere1)  
        sphere2 = Sphere(center=(-1, -3, 0), radius=2, resolution=(18, 18))  # expected shading
        sphere2.set_color(GREEN)
        self.add(sphere2)
        sphere3 = Sphere(center=(-1, 2, 0), radius=2, resolution=(16, 16))   # expected shading
        sphere3.set_color(BLUE)
        self.add(sphere3)

Additional comments

I spent plenty of time guessing what's wrong with that shading. Finally, I tried the default initialization sph = Sphere() which did not show the above behavior. Therefore, I believe this example is a misleading one, isn't it?

@shifs999
Copy link

I think I came up with a solution to fix the issue, how do I submit the code. Sorry, I am new to Open Source Contributions.

@JasonGrace2282
Copy link
Member

I think I came up with a solution to fix the issue, how do I submit the code. Sorry, I am new to Open Source Contributions.

It's explained in our contributing docs here
https://docs.manim.community/en/latest/contributing/development.html

@Jackyuanx Jackyuanx linked a pull request Oct 23, 2024 that will close this issue
3 tasks
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 a pull request may close this issue.

3 participants