PEXXCToNPCTransform2D Utility


Synopsis

 
   int PEXXCToNPCTransform2D(
       PEXNPCSubVolume *npc_sub_volume,
       PEXDeviceCoord2D *viewport,
       unsigned int window_height,
       PEXMatrix3x3 transform_return
   )
 

Arguments

npc_sub_volume
A pointer to an NPC subvolume, typically that of a renderer resource.

viewport
An array of two device coordinate points defining a viewport, typically that of a renderer resource. The first point in the array is the lower-left corner of the viewport; the second point is the upper-right.

window_height
The height of the drawable.

transform_return
The returned transformation.

Returns

Zero if successful; otherwise, one of the following:

PEXBadViewport
xmin >= xmax, or ymin >= ymax

PEXBadSubVolume
xmin >= xmax, or ymin >= ymax, or zmin > zmax

Description

Invoke PEXXCToNPCTransform2D to compute the two-dimensional transformation matrix to map a drawable point (XC) to NPC coordinates, using the specified NPC subvolume, DC viewport, and drawable height.

The returned transformation matrix first transforms the x and y coordinates of drawable points to device coordinates (DC), then applies the two-dimensional components of the viewport-to-subvolume transformation, producing two-dimensional NPC points.

When specifying NPC and DC, the x, y and z limits must be as follows:

  xmin < xmax, ymin < ymax, zmin <= zmax

Errors

None.

See Also

For a list of miscellaneous transformation utilities, see Miscellaneous Transformation Utilities. For a list of related topics, see PEXlib Utilities.