Skip to content
Snippets Groups Projects
Commit 601c7836 authored by Shiven Bhatt's avatar Shiven Bhatt
Browse files

raytracing scene

parent 188dc057
No related branches found
No related tags found
No related merge requests found
lightbulb.png

2.06 KiB

from manim import *
from matplotlib.lines import Line2D
SCREEN_WIDTH = 14.2
SCREEN_HEIGHT = 8
......@@ -101,4 +102,34 @@ class RasterizationTriangleScene(ThreeDScene):
class RaytracingScene(Scene):
def construct(self):
square = Square(side_length=3)
square.shift([1, 1])
square.shift([1, 1, 0])
circle = Circle(radius=1.5)
circle.shift([-3, -2, 0])
triangle = Triangle()
triangle.shift([1.5, -3, 0])
lightbulb = ImageMobject("lightbulb.png")
lightbulb.shift([-0.75, -3.5, 0])
self.add(lightbulb)
self.play(Create(square), run_time=0.5)
self.play(Create(circle), run_time=0.5)
self.play(Create(triangle), run_time=0.5)
self.wait(1)
light_rays = [
([-2, 5, 0], [-2, -0.85, 0]),
([-2, -0.85, 0], [1.4, -2.2, 0]),
([1.4, -2.2, 0], [0, -0.5, 0]),
([0, -0.5, 0], [-0.7, -3.3, 0])
]
for ray in light_rays:
self.play(Create(Line3D(start=ray[0], end=ray[1], color=YELLOW)), run_time=0.5)
self.wait(3)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment