A camera sees the world through a pinhole. Think of its photo as a window f pixels in front of the pinhole: a point lands on the photo where the straight line from it to the pinhole crosses that window. Write project(side, ahead, f): a point side metres right of the camera’s middle line and ahead metres in front of it lands how many pixels right of the photo’s middle? Left is negative.
A camera at the end of an avenue of trees, all the same size. The obvious idea, every tree on one side landing on one spot, sees only the near tree. Each tree lands where its line to the pinhole crosses the photo. The goal is a photo like the one it ends on. Your project says where on the photo a point lands.
project(side, ahead, f)| side | how far right of the camera's middle line the point is, in metres (left is negative) | e.g. 2 |
| ahead | how far in front of the camera the point is, in metres | e.g. 4 |
| f | how far the photo is from the pinhole (the focal length), in pixels | e.g. 400 |
| returns | where the point lands on the photo: pixels right of the photo's middle (left is negative) | |