Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from manim import *
- class IntersectionScene(ThreeDScene):
- def construct(self):
- # конус
- radius = 1
- height = 2
- surface = Surface(
- lambda u, v: np.array([
- radius * v * np.cos(u),
- radius * v * np.sin(u),
- height * (1 - v)
- ]),
- u_range=[0, 2 * PI],
- v_range=[0, 1],
- resolution=(20, 20),
- ).set_color(TEAL, 0.6).set_fill(TEAL, 0.6)
- # плоскость
- plane = Surface(
- lambda u, v: np.array([u, v, z.get_value()]),
- u_range=[-2, 2],
- v_range=[-2, 2],
- resolution=(20, 20),
- ).set_color(YELLOW, 0.6).set_fill(YELLOW, 0.6)
- # пересечение
- intersection = always_redraw(lambda:
- Intersection(
- surface, plane,
- fill_color = GREEN,
- fill_opacity = 1,
- stroke_color = GREEN,
- stroke_opacity = 1
- )
- )
- self.set_camera_orientation(phi=75 * DEGREES, theta=45 * DEGREES)
- self.add(surface, plane, intersection)
- self.wait()
- self.play(plane.animate.shift(2 * OUT), run_time = 4)
- self.wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement