BUILD TRANSFORMATION MATRIX(3P) — SUNPHIGS LIBRARY
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
pbuildtran ( pt, shift, angle, scale, error_ind, matrix )
Ppoint∗pt;fixed point
Pvector∗shift;shift vector
Pfloatangle;rotation angle
Pvector∗scale;scale vector
Pint∗error_ind;OUT error indicator
Pmatrixmatrix;OUT transformation matrix
FORTRAN Syntax
SUBROUTINE pbltm ( X0, Y0, DX, DY, PHI, FX, FY, ERRIND, XFRMT )
REALX0, Y0fixed point
REALDX, DYshift vector
REALPHIrotation angle (radians)
REALFX, FYscale factor vector
INTEGERERRINDOUT error indicator
REALXFRMT(3, 3)OUT transformation matrix
Required PHIGS Operating States
(PHOP, ∗, ∗, ∗)
DESCRIPTION
Purpose
Use BUILD TRANSFORMATION MATRIX to calculate the 2D homogeneous (3 x 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 Pvector structure containing the xand ycoordinates that define the shift (translation) applied by the transformation. Pvector is defined in phigs.h as follows:
typedef struct {
Pfloatx;/∗ x magnitude ∗/
Pfloaty;/∗ y magnitude ∗/
} Pvector;
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 Pvector 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 x 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];
FORTRAN Input Parameters
X0, Y0
The xand ycoordinates of a fixed point in Modelling Coordinates. Scaling and rotation are performed relative to this fixed point.
DX, DY
The xand ycoordinates defining the shift (translation) to be applied by the transformation.
PHIThe angle of rotation, in radians, to be applied by the transformation. A positive angle is a counter-clockwise rotation; a negative angle is clockwise rotation.
FX, FY
The xand yvalues defining the scale factors to be applied by the transformation.
FORTRAN Output Parameters
ERRIND
The error number of any error detected by this function.
XFRMT
A 3 x 3 homogeneous transformation matrix that performs the transformation defined by the input parameters.
Execution
BUILD TRANSFORMATION MATRIX returns a 2D (3 x 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)
Sun Release 4.0 — Last change: 31 July 1989