# Cylinder Lab

This lab builds on your experience with 2D parametric surfaces from the last lab and adds in a projection transformation so that you can view portions of the world besides the unit cube. You will build a cylinder and then render it in perspective.

## Cylinder

Your first challenge is to render a cylinder. Like the sphere, the cylinder is a cousin to the grid. Follow these steps to generate your cylinder:

On paper, draw the rotational cross section of a cylinder using just four vertices. Place the first vertex on the negative y-axis, the second in quadrant 4, the third in quadrant 1, and the fourth on the positive y-axis. The positions should form a rectangle.
Rotate this rectangle a bit around the y-axis and connect the positions to their rotated counterparts. Rotate again. And again. And again, until you see how the rotations form the cylinder.
In main.js of the cylinder application, write a function named generateCylinder. Have it accept parameters for the number of lines of latitude, the number of lines of longitude, the height, and the radius.
Implement the following pseudocode to generate the seed positions along the right semi-circle:
make seeds array with four vertices as Vector4
for each longitude index
compute longitude proportion
compute degrees by applying longitude proportion
generate a rotation matrix around y-axis
for each of the four seed positions
rotate seed position by matrix
push rotated position into positions list
Stitch the vertices into triangles just like you did with the grid.
Draw the cylinder as indexed geometry.
Your second challenge is to render the cylinder with a perspective projection. Send a perspective matrix to the vertex shader and transform all vertices by it. You are encouraged to name the matrix clipFromWorld because this name communicates the spaces that the transformation spans.
The starter code already applies a rotation. Combine the translation and rotation together into a matrix named worldFromModel. Ensure that the rotation gets applied first. The vertex shader then receives just two matrices: clipFromWorld and worldFromModel. These two will take the position attribute all the way from model space into clip space.