For the examples you need "pillow" installed. This can be done using pip. Some examples generate animated gif, for that you need the moviepy module. Please note that moviepy has a lot of dependencies - for example numpy - which are also installed.
pip install Pillow
pip install moviepy
or by running this Python code:
import pip
pip.main(['install', 'Pillow'])
pip.main(['install', 'moviepy'])
The first series of examples is just about images and drawing into them. It is important to understand the concept of an "image generator". While most graphics applications draw something on the screen, in pyRT there is no interactive window displaying anything. Images are for example generated as list of RGB tuples, which are then stored as an image in a common format like PNG.
This example creates an image and draws 5000 random points using image.drawPoint(point,color)
The image is stored using pillow.
This example draws 500 random lines using using image.drawLine(start, end, color). Drawing lines is done using the Bresenham line drawing algorithm.
J. E. Bresenham. 1965. Algorithm for computer control of a digital plotter. IBM Syst. J. 4, 1 (March 1965), 25-30. DOI=http://dx.doi.org/10.1147/sj.41.0025
This example draws a Koch curve using recursion. It is just another example how line drawing can be used.
This example draws 100 random circles using image.drawCircle(center, radius, color). Drawing lines is done using the Midpoint circle algorithm.
This example draws 50 random rectangles using image.drawRectangle(bottomleft, width, height, color).
This example shows how a projection matrix and the viewing transformation is used to render a (wireframe) 3D triangle on the image.
This example generates an animated gif by moving the camera (changing the view matrix). The movie is created using moviepy module which is required to run this example.
This example creates a scene with the same triangle like in example 5. Then it renders it using the SimpleRT raytracer.
08_raytracingtriangle_colorvertex.py
This example adds a triangle with different vertex colors to the scene.
This example renders two triangles
This example renders a sphere
This example renders a sphere with a light
12_smallscene.py 12b_animated_scene.py
This example renders 4 spheres on ground (2 triangles). The second version (12b) animates the light source and generates a gif.
This example uses the scene from example 11. It changes the material of the spheres to supoprt reflections.