PEXPolarViewMatrix Utility


Synopsis

 
   int PEXPolarViewMatrix(
       PEXCoord *from,
       double distance,
       double azimuth,
       double altitude,
       double twist,
       PEXMatrix matrix_return
   )
 

Arguments

from
The viewing position.

distance
The distance between the from position and the position being viewed.

azimuth
The angle in the x, z plane from the +z axis to the line of sight, in radians. Positive values are counter-clockwise when viewed from the +y axis.

altitude
The angular inclination of the line of sight from the x, z plane. The altitude argument is the angle in radians. Positive values are towards the positive y axis.

twist
The up direction of the view, given as an angle, in radians, about the line of sight. Positive values of twist are in the counter-clockwise direction.

matrix_return
Matrix in which result is stored.

Returns

Zero if successful; otherwise, one of the following:

PEXBadDistance
The distance specified is zero.

Description

Invoke PEXPolarViewMatrix to create a polar view orientation matrix. This utility is similar to PEXLookAtViewMatrix, except you specify the viewing arguments in spherical coordinates.

The from position defines one end of the view plane normal; the position indicated by distance, azimuth, and altitude define the base of the view plane normal, and the origin of VRC.

The view is defined with respect to the from position (the viewing position) and the distance between it and the position being viewed. The azimuth angle specifies the direction of the line of sight going toward the position being viewed. Positive values of azimuth are counter-clockwise when viewed from the positive y axis.

The azimuth and altitude angles apply to the coordinate system with from at the origin and the line of sight emanating from it. The azimuth specifies the angle between the line of sight and the +z axis, and the altitude defines the angle between it and the x, z plane.

When applied, the transformation places the viewing position at the origin, aligns the viewpoint with the +z axis, applies any twist to the coordinates, and then places the viewed point at the origin.

Errors

None.

See Also

For a list of viewing transformation utilities, see Viewing Transformation Utilities. For a list of related topics, see PEXlib Utilities.