Home Page

Home Page

Comp 236

Programming Assignment 1:  "One True Way" Projection of a 3D Box

Page 1

Background

I chose to do a C++ implementation for Choice 1 of Programming Assignment 1. Choice 1 involved implementing a virtual 35mm camera using the "one true way," a vector-based transformation technique discussed in class. The virtual camera has a 15mm lens. The object to be viewed is a box represented by points at the corners and edge-centers (20 points total). The box is about 12 inches tall, 8 inches wide, and 3 inches thick.

The question we are trying to answer is this: from a particular camera position/rotation, which points fall on the "film" when mapped onto the image plane? (Note: The light-sensitive area of 35mm film is about 36x24mm).

From class, given a point in the world, the top equation on the left maps the point onto the image plane. The point is represented by xw, the vector from the origin of the world to the point. The position of the camera is represented by c, the vector from the origin of the world to the camera's center of projection.

The bottom equation on the left gives the details of tu. If you divide through by t, you're left with [ua,ub,1]. Multiply ua by the width of the "film" (36mm) and multiply ub by the height of the "film" (24mm), and you have your (x,y) coordinates in the image plane. If the x coordinate is >= 0mm and <= 36mm and the y coordinate is >= 0mm and <= 24mm, then the point falls on the "film" and thus is within the field of view of the camera.

The details of the Pwi matrix are given below. The A vector is horizontal in the image plane and represents the width of the film. The B vector is vertical in the image plane and represents the height of the film. O is the vector from the center of projection to the origin (i.e. the lower left corner) of the film. Note that these numbers assume that the camera axes and the world axes are aligned.

Email Jason Stewart