SYNOPSIS
#include <volpack.h>
vpResult
-
vpWindowPHIGS(vpc, vrp, vpn, vup, prp, umin, umax, vmin, vmax,
- front, back, projection_type
) - vpContext *vpc;
- vpVector3 vrp, vpn, vup;
- vpVector3 prp;
- double umin, umax, vmin, vmax, front, back;
- int projection_type;
ARGUMENTS
- vpc
- VolPack context from vpCreateContext.
- vrp
- Point specifying the view reference point.
- vpn
- Vector specifying the view plane normal.
- vup
- Vector specifying the view up vector.
- prp
- Point specifying the projection reference point (in view reference coordinates).
- umin
- Left coordinate of clipping window (in view reference coordinates).
- umax
- Right coordinate of clipping window (in view reference coordinates).
- vmin
- Bottom coordinate of clipping window (in view reference coordinates).
- vmax
- Top coordinate of clipping window (in view reference coordinates).
- front
- Coordinate of the near depth clipping plane (in view reference coordinates).
- back
- Coordinate of the far depth clipping plane (in view reference coordinates).
- projection_type
- Projection type code. Currently, must be VP_PARALLEL.
DESCRIPTION
vpWindowPHIGS is used to multiply the current projection matrix by a viewing and projection matrix specified by means of the PHIGS viewing model. This model combines specification of the viewpoint, projection and clipping parameters. The resulting matrix is stored in the projection transformation matrix. Since both the view and the projection are specified in this one matrix, normally the view transformation matrix is not used in conjunction with vpWindowPHIGS (it should be set to the identity). Currently, only parallel projections may be specified. For an alternative view specification model, see vpWindow(3).Assuming that the view transformation matrix is the identity, the matrix produced by vpWindowPHIGS should transform world coordinates into clip coordinates. This transformation is specified as follows. First, the projection plane (called the view plane) is defined by a point on the plane (the view reference point, vrp) and a vector normal to the plane (the view plane normal, vpn). Next, a coordinate system called the view reference coordinate (VRC) system is specified by means of the view plane normal and the view up vector, vup. The origin of VRC coordinates is the view reference point. The basis vectors of VRC coordinates are:
-
u = v cross n
v = the projection of vup parallel to vpn onto the view plane
n = vpn
This coordinate system is used to specify the direction of projection and the clipping window. The clipping window bounds in the projection plane are given by umin, umax, vmin and vmax. The direction of projection is the vector from the center of the clipping window to the projection reference point (prp), which is also specified in VRC coordinates. Finally, the front and back clipping planes are given by n=front and n=back in VRC coordinates.
For a more detailed explanation of this view specification model, see Computer Graphics: Principles and Practice by Foley, vanDam, Feiner and Hughes.
STATE VARIABLES
The current matrix concatenation parameters can be retrieved with the following state variable codes (see vpGeti(3)): VP_CONCAT_MODE.ERRORS
The normal return value is VP_OK. The following error return values are possible:- VPERROR_BAD_VALUE
- The clipping plane coordinates are invalid (umin >= umax, etc.).
- VPERROR_BAD_OPTION
- The type argument is invalid.
- VPERROR_SINGULAR
- The vectors defining view reference coordinates are not mutually orthogonal, or the projection reference point lies in the view plane.