3b1b / 3b1b/manim

3D rotations of a function about an axis

Open
#973 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
93.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

I recently installed Manim and am using it to visualise solids of revolution. I figured out how to construct 3D parametric surfaces, but am still struggling to rotate a function. I saw the code from a few of 3b1b's videos and could rotate 3D objects about points. Can someone help me out with the code to animate the rotation of the function y=x^2 about the x axis?

`class RotationsIn3d(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi=80 * DEGREES,theta=-60*DEGREES)
self.begin_ambient_camera_rotation(rate=0.02)
curve1=ParametricFunction(
lambda u : np.array([
2*u**2,
4*u,
0
]),color=RED,t_min=0,t_max=1,
)
axes = ThreeDAxes()

self.add(axes)
self.play(Write(curve1))
angle_axis_pairs = [
(90 * DEGREES, RIGHT),
(90 * DEGREES, UP),
(90 * DEGREES, IN),
]

self.play(Rotate(curve1,90*DEGREES, about_edge = Y_AXIS))

self.wait()`

This is what I have as of now. I thought that the "about_edge" method would work but it didn't.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.