-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
Description of bug / unexpected behavior
I want to rotate 3D so that X and Y are like 2D, with Z being out.
There is no "Out" option so I am left with the default.
This code has a work around for showing labels due to some
limitation of Cairo (per ChatGPT).
Expected behavior
Labels should rotate correctly.
Cannot add numbers in axes.
No "Out" option for Z.
How to reproduce the issue
Code for reproducing the problem
With Jupyter
%%manim -qm -v WARNING Label3DAxes
from manim import *
class Label3DAxes(ThreeDScene):
def construct(self):
# Set camera so XY plane is front-facing, Z comes out
self.set_camera_orientation(phi=0 * DEGREES, theta=90 * DEGREES)
# Create 3D axes
axes = ThreeDAxes(
x_range=[-3, 3, 1],
y_range=[-3, 3, 1],
z_range=[-3, 3, 1],
x_length=6,
y_length=6,
z_length=6
)
self.add(axes)
# Create MathTex labels
x_label = MathTex("X").scale(1.2).move_to(axes.c2p(3.2, 0, 0))
y_label = MathTex("Y").scale(1.2).move_to(axes.c2p(0, 3.2, 0))
z_label = MathTex("Z").scale(1.2).move_to(axes.c2p(0, 0, 3.2))
# Save original orientation to prevent spinning
for label in [x_label, y_label, z_label]:
label.save_state()
def face_camera(label):
label.restore()
label.rotate(-self.camera.get_phi(), axis=RIGHT)
label.rotate(-self.camera.get_theta(), axis=UP)
for label in [x_label, y_label, z_label]:
label.add_updater(face_camera)
self.add(label)
# Add a cube for spatial reference
cube = Cube(side_length=2).move_to(axes.c2p(0, 0, 0))
self.add(cube)
# Rotate around Z axis (depth)
self.begin_ambient_camera_rotation(rate=0.2, axis=OUT)
self.wait(8)
self.stop_ambient_camera_rotation()
Additional media files
Images/GIFs
Add the code to current Jupyter Notebook Examples
System specifications
System Details
- OS (Windows 11)
- RAM: 16 GB
- Python version Latest
- Installed modules
PASTE HERE
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🆕 New