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

[EXPERIMENTAL] Remove ThreeDScene and rewrite Camera internals #4059

Open
wants to merge 5 commits into
base: experimental
Choose a base branch
from

Conversation

chopan050
Copy link
Contributor

@chopan050 chopan050 commented Dec 15, 2024

  • Deleted ThreeDScene and moved many of its methods into Camera. For example, ThreeDScene.begin_ambient_camera_rotation() becomes Camera.begin_ambient_rotation() and ThreeDScene.begin_3dillusion_camera_rotation() becomes Camera.begin_precession().
  • All the references to ThreeDScene were changed to Scene.
  • Camera was rewritten to work directly with ._theta, ._phi and ._gamma angles rather than using an .orientation quaternion which is constantly converted to a SciPy Rotation and then to a matrix, Euler angles or another quaternion.
  • Now the starting ._theta angle for Camera is -TAU/4 instead of 0, which is more representative of its initial orientation. When increasing ._phi a bit, the Camera is positioned over the negative Y axis, which corresponds to theta=-TAU/4, not theta=0.
  • Camera now directly uses .focal_distance instead of .focal_dist_to_height. This was needed in order to correctly implement zooming.
  • Now Camera can be properly zoomed in and out. Previously, it couldn't. Scaling the Camera used to only cause a difference in the focal distance.

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

@chopan050 chopan050 changed the base branch from main to experimental December 15, 2024 22:47
@chopan050 chopan050 changed the title [EXPERIMENTAL] Implement ThreeDScene and rewrite Camera internals [EXPERIMENTAL] Remove ThreeDScene and rewrite Camera internals Dec 16, 2024
Copy link
Member

@JasonGrace2282 JasonGrace2282 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just one small change/discussion

@@ -28,6 +29,7 @@ def __init__(self):
self.capabilities = [
(OpenGLVMobject, self.render_vmobject),
(ImageMobject, self.render_image),
(OpenGLMobject, lambda mob: None),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of this in experimental, I would prefer a hard error (XYZ cannot be rendered)

Maybe a marker class is neccessary? Something like

class InvisibleMobject:
    pass

class Camera(OpenGLMobject, InvisibleMobject):
    ...

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.

2 participants