Cylindrical Surface with Manim
Category
A partial cylindrical surface of radius radius 4 units and axis on the xz-plane and at a distance of 1.5 units from the xy-plane. The thickness of the cylinder is 4 units and the curvilinear length is half the circle.
I use the following code to animate the curved beam in the derivation of bending stress. If you are interested about flexural stress, you can watch the whole video here: https://www.youtube.com/watch?v=5LXEHkeL8Ck. You can jump to 3:30 if you are only interested to how this was implemented to the video.
from manimlib.imports import *
class PartialCylinder(ThreeDScene):
def construct(self):
# Call the xyz-axes
xyz = ThreeDAxes()
# Define surface attributes. Note: TAU = 2*PI
CylSurf = ParametricSurface(
self.CylindricalSurface,
u_min=PI,
u_max=TAU,
v_min=-2,
v_max=2,
resolution=(15,7)
).set_fill(opacity=0.8)
# Initialize camera to show the xz-plane
self.set_camera_orientation(phi=90*DEGREES, theta=-90*DEGREES)
# Create the surface together with the xyz-axes
self.play(ShowCreation(CylSurf), ShowCreation(xyz), run_time=2)
self.wait(1)
# Rotate Camera
self.move_camera(phi=60*DEGREES,theta=-60*DEGREES,run_time=3)
self.begin_ambient_camera_rotation(rate=0.2)
self.wait(8)
# Parametric Equation of Cylindrical surface with axis parallel to
# and 1.5 units above the xy-plane
def CylindricalSurface(self, u, v):
return [ 4*np.cos(u), v, 4*np.sin(u) + 1.5 ]
Output video: