<filename>Chapter 04/stretch_teapot.py<gh_stars>0
from teapot import load_triangles
from draw_model import draw_model
from math import pi

def polygon_map(transformation, polygons):
    return [
        [transformation(vertex) for vertex in triangle]
        for triangle in polygons
    ]

def stretch_x(vector):
    x,y,z = vector
    return (4.*x, y, z)

####################################################################
#### this code takes a snapshot to reproduce the exact figure 
#### shown in the book as an image saved in the "figs" directory
#### to run it, run this script with command line arg --snapshot
import sys
import camera
if '--snapshot' in sys.argv:
    camera.default_camera = camera.Camera('fig_4.13_stretch_teapot',[0])
####################################################################

draw_model(polygon_map(stretch_x, load_triangles()))
