To view this content, you need to install Java from java.com

2D illustration of the Perspective Transformation

The viewing direction is along the x-axis. The screen is the left border of the yellow region.
We use the homogeneous transform: y'=dy/(d+x); x'=dx/(d+x); which places the origin O on the screen.
(Note that most graphic systems place the origin a the eye. To transform our coordinate system into the other one, define z=x+d, which yields x=z-d, and z'=x'. By substitution, we obtain: y'=dy/(d+z-d), which yields y'=dy/z, and z'=d(z-d)/(d+z-d), which yields z'=d-d/z.

You can change the perspective factor, d, by clicking and dragging the viewpoint along the viewing direction (x-axis), but do not drag it onto the screen! You cn also move the vertices of the object, but do not drag them to the left past the viewpoint.

Notice that all points on the right of the screen are mapped to the yellow band of width d to the right of the screen. In fact, all points with x>2d are mapped to the right half of the yelow band (perspective compression). Notice also that the perspective transformation maps lines to lines and preserves the orientation of linees paralel to the screen.

The 10 green strobe ghost lines show the perspective transform obtained by multiplying d by 2, 3, 4... They illustrate that the perspective transfrom is a scaling with respect to O. Hence, vertices move towards O along the red displacement vectors. They stop when they have reached the proper height (y-value), which corresponds to the coordinates of the pixel at which they would appear if the viewer moved further away (increasing d). The horizontal blue lines show the proper height. Hence, you can construct the perspective transform of a point P geometrically by constructing the intersection Q of the screen with the ray from the eye to P. Then, construct the blue horizontal through Q . The transformed point, P', is where the horizntal intersects the segment PO.

Built with Processing by Jarek Rossignac on Sept 28, 2005. Source code: perspective pts2