Graphics Window Coordinate Systems
 
 
 

There are two primary coordinate systems within a GraphicsWindow: device-independent 3D eye coordinates and device-dependent window coordinates.

Device-dependent coordinates are integer triples that have their origin at the lower-left corner of the window and increase toward the upper right. One unit corresponds to a single pixel. Z values closest to the user are 0, and they increase into the screen. The maximum Z value is driver-dependent. This coordinate system is left-handed.

Eye coordinates are floating point triples that correspond to relative distances from the camera (or "eye") associated with the window. In eye coordinates, x increases toward the right, y increases upward, and z decreases away (and in front of) the eye point. This coordinate system is right-handed.

There are two ways to set up eye coordinates. In the first, the camera is assumed to be sitting at the origin looking down the negative z axis. You specify camera parameters (perspective/orthographic, field-of-view, etc.) and then provide a transformation matrix for an object's position relative to the camera. This is most easily accomplished by concatenating the inverse affine transformation for the camera's position in world space with the (forward) affine transformation of the object in world space.

An affine transformation is a geometric transformation -- move, rotation, or scale -- that can alter distances between points or angles between lines, but preserves straight lines and the parallel relation between parallel lines.

In the second method, a camera matrix is specified that includes both the world position (affine transformation) and projection information. This allows for a simple camera "look at" transformation model.

Note that the system stores two matrices: a camera matrix (which can be a pure projection), and an affine transformation matrix. When deriving device coordinates for a geometric primitive, each position is logically transformed through the affine transformation first, followed by the camera transformation. This allows each geometric primitive to be represented in its own local coordinates.

In addition to providing a method for transforming points from local, model coordinates to floating point device coordinates, a method is provided that transforms model coordinates into integer window coordinates with the origin at the upper left. These integer coordinates correspond to the coordinates used by GDI and the Windows mouse routines.

Both model-to-device coordinate methods return clipping values indicating whether the transformed point lies outside of the view volume. Flags are provided for each of the six planes bounding the viewing frustum.