COMPOSE TRANSFORMATION MATRIX(3P) — Kubota Pacfic Computer Inc. (29 February 1991)
NAME
COMPOSE TRANSFORMATION MATRIX − compose a 2D transformation matrix, which is the composition of a specified matrix and a transformation matrix defined by a fixed point, shift vector, rotation angle, and scale factors
SYNOPSIS
C Syntax
void
pcompose_tran_matrix ( m, pt, shift, angle, scale, error_ind, result )
Pmatrixm;transformation matrix
Ppoint∗pt;fixed point
Pvec∗shift;shift vector
Pfloatangle;rotation angle
Pvec∗scale;scale vector
Pint∗error_ind;OUT error indicator
Pmatrixresult;OUT transformation matrix
Required PHIGS Operating States
(PHOP, ∗, ∗, ∗)
DESCRIPTION
Purpose
Use COMPOSE TRANSFORMATION MATRIX to generate a 2D homogeneous (3 × 3) matrix that composes an existing 3 × 3 matrix with a transformation specified by 2D values for scaling, rotation, and translation about a fixed point.
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
mThe 2D (3 × 3) homogeneous transformation matrix to use in the composition. This matrix is a Pmatrix type, defined in phigs.h as follows:
typedef Pfloat Pmatrix[3][3];
ptA pointer to a Ppoint structure containing the x and y coordinates 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;
shiftA pointer to a Pvec structure containing x and y coordinates defining the shift (translation) to be added to the transformation. Pvec is defined in phigs.h as follows:
typedef struct {
Pfloatdelta_x;/∗ x magnitude ∗/
Pfloatdelta_y;/∗ y magnitude ∗/
} Pvec;
angleThe angle of rotation, in radians, to be added to the transformation. A positive angle is a counter-clockwise rotation. A negative angle is clockwise rotation.
scaleA pointer to a Pvec structure containing x and y values defining the scale factors to be applied to the transformation.
C Output Parameters
error_ind
A pointer to the location to store the error number of any error detected by this function.
resultThe resulting 2D (3 × 3) transformation matrix.
Execution
COMPOSE TRANSFORMATION MATRIX returns the matrix that performs the transformation resulting from the composition of the input matrix and the matrix specified by the input parameters shift, angle, and scale. Rotation and scaling are calculated relative to the fixed point.
The composition is performed as: result = a x b
Where b is the input matrix and a is the matrix built from the other input parameters.
The order of operations used to build the transformation matrix b is:
• scale
• rotate
• shift (translate)
ERRORS
002Ignoring function, function requires state (PHOP, ∗, ∗, ∗)
SEE ALSO
COMPOSE TRANSFORMATION MATRIX 3 (3P)
COMPOSE MATRIX (3P)
BUILD TRANSFORMATION MATRIX (3P)
SET LOCAL TRANSFORMATION (3P)
SET GLOBAL TRANSFORMATION (3P)
September 02, 1992