BUILD TRANSFORMATION MATRIX(3P) — Kubota Pacfic Computer Inc. (29 February 1991)
NAME
BUILD TRANSFORMATION MATRIX − generate a 2D transformation matrix to perform a transformation specified by a shift vector, rotation angle, and scale factors relative to a specified fixed point
SYNOPSIS
C Syntax
void
pbuild_tran_matrix ( pt, shift, angle, scale, error_ind, matrix )
Ppoint∗pt;fixed point
Pvec∗shift;shift vector
Pfloatangle;rotation angle
Pvec∗scale;scale vector
Pint∗error_ind;OUT error indicator
Pmatrixmatrix;OUT transformation matrix
Required PHIGS Operating States
(PHOP, ∗, ∗, ∗)
DESCRIPTION
Purpose
Use BUILD TRANSFORMATION MATRIX to calculate the 2D homogeneous (3 × 3) transformation matrix that performs the transformation specified by the input parameters.
The returned matrix may be passed as an argument to SET LOCAL TRANSFORMATION or SET GLOBAL TRANSFORMATION to modify the modelling transformation that is applied to output primitives during traversal.
C Input Parameters
ptpt points to the Ppoint structure containing the xand ycoordinates of a fixed point in Modelling Coordinates. Scaling and rotation are performed relative to this fixed point. Ppoint is defined in phigs.h as follows:
typedef struct {
Pfloatx;/∗ x coordinate ∗/
Pfloaty;/∗ y coordinate ∗/
} Ppoint;
shiftshift points to a Pvec structure containing the xand ycoordinates that define the shift (translation) applied by the transformation. Pvec is defined in phigs.h as follows:
typedef struct {
Pfloatdelta_x;/∗ x magnitude ∗/
Pfloatdelta_y;/∗ y magnitude ∗/
} Pvec;
angleThis is the angle of rotation, in radians, applied by the transformation. A positive angle is a counter-clockwise rotation; a negative angle is clockwise rotation.
scalescale points to a Pvec structure containing xand yvalues defining the scale factors to be applied by the transformation.
C Output Parameters
error_ind
error_ind points to the location that stores the error number for any error detected by this function.
matrixA 3 × 3 homogeneous transformation matrix that performs the transformation defined by the input parameters. The matrix is returned in a Pmatrix array defined in phigs.h as follows:
typedef Pfloat Pmatrix[3][3];
Execution
BUILD TRANSFORMATION MATRIX returns a 2D (3 × 3) homogeneous transformation matrix that performs the transformation specified by the input parameters.
The transformation is performed in the following order:
• scale
• rotate
• shift
Scaling and rotation are done in relation to the fixed point.
ERRORS
002Ignoring function, function requires state (PHOP, ∗, ∗, ∗)
SEE ALSO
SET LOCAL TRANSFORMATION (3P)
SET GLOBAL TRANSFORMATION (3P)
COMPOSE TRANSFORMATION MATRIX (3P)
COMPOSE MATRIX (3P)
September 02, 1992