Open nakulkhambhati opened 4 years ago
Hii, this is how you can do it:
class RotationsIn3d(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi=80 * DEGREES, theta=-60 * DEGREES)
def func():
param = ParametricFunction(
lambda u: np.array([
2 * u ** 2,
4 * u,
0
]), color=RED, t_min=0, t_max=1)
return param
curve1 = func()
curve2 = curve1.copy()
def update_curve(d,dt):
d.rotate_about_origin(dt, RIGHT)
curve2.add_updater(update_curve)
axes = ThreeDAxes()
self.add(curve1,curve2)
self.add(axes)
self.wait(2*PI)
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=-60DEGREES) self.begin_ambient_camera_rotation(rate=0.02) curve1=ParametricFunction( lambda u : np.array([ 2*u*2, 4u, 0 ]),color=RED,t_min=0,t_max=1, ) axes = ThreeDAxes()
This is what I have as of now. I thought that the "about_edge" method would work but it didn't.