concat_transformation(3G)
NAME
concat_transformation2d, concat_transformation3d, intconcat_transform2d − pre-concatenate or post-concatenate user-supplied transformation matrix with current transformation matrix
SYNOPSIS
C Syntax:
void concat_transformation2d(fildes,xform2,sequence,stack);
int fildes,sequence,stack;
float xform2[3][2];
void concat_transformation3d(fildes,xform3,sequence,stack);
int fildes,sequence,stack;
float xform3[4][4];
void intconcat_transform2d(fildes,xform2,radix,sequence,stack,raw);
int fildes,radix,sequence,stack,raw;
int xform2[3][2];
FORTRAN77 Syntax:
(see Language Dependencies below)
subroutine concat_transformation2d(fildes,xform2,sequence,stack)
integer*4 fildes,sequence,stack
real xform2(2,3)
subroutine concat_transformation3d(fildes,xform3,sequence,stack)
integer*4 fildes,sequence,stack
real xform3(4,4)
subroutine intconcat_transform2d(fildes,xform2,radix,sequence,stack,raw)
integer*4 fildes,radix,sequence,stack,raw,xform2(2,3)
Pascal Syntax:
type
int2d_xform=array[1..3][1..2] of integer;
two_d_xform = array [1..3][1..2] of real;
three_d_xform = array [1..4][1..4] of real;
procedure concat_transformation2d(fildes:integer;var xform2:two_d_xform;
sequence,stack:integer);
procedure concat_transformation3d(fildes:integer;var xform3:three_d_xform;
sequence,stack:integer);
procedure intconcat_transform2d(fildes:integer;var xform2:int2d_xform;
radix,sequence,stack,raw:integer);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen When an I/O path to a graphics device is opened.
xform2 3x2 (2-dimensional transform) matrix.
xform3 4x4 (3-dimensional transform) matrix.
radix is the radix factor for the 3x2 integer matrix.
sequence If set to POST, post-concatenation is performed.
If set to PRE, pre-concatenation is performed.
stack If set to PUSH, the result matrix is to be pushed on top of the matrix stack.
If set to REPLACE, the result matrix replaces the top matrix on the matrix stack.
raw If set to TRUE(1), the integer matrix is in internal (raw) format (i.e. translation values are not scaled).
If set to FALSE(0), all integer matrix values are scaled.
Discussion
The specified matrix is concatenated with the current transformation matrix (top matrix on the matrix stack). The resulting matrix is pushed on the top of the matrix stack if stack is PUSH. If stack is REPLACE, the resulting matrix replaces (destructive replacement) the current top of matrix stack. In either case, the resulting matrix becomes the current transformation matrix and is left on the top of the matrix stack. The current transformation matrix is used to transform subsequent output primitives.
The coordinate systems used by Starbase may be conceptually defined as follows:
1. User points are assumed to be defined in modeling coordinates. These points are transformed into world coordinates by use of a matrix called the modeling transformation matrix if any matrices have been pushed on the stack. World coordinates are used to perform any necessary rendering calculations. Use concat_transformation to place or modify modeling transformations on the matrix stack after defining the viewing transformation.
2. World coordinates are then transformed to device coordinates by the viewing transformation matrix, which is usually the concatenation of user-defined viewing transformations and the device transformation (VDC-to-DC) matrix. When a device is opened the viewing transformation matrix is simply the VDC-to-DC transformation matrix. Intview_window, intview_port, intview_matrix, view_camera, view_port, view_window, view_volume, and view_matrix can be used to define further viewing transformations such as perspective.
If a graphics device has been opened in MODEL_XFORM mode, the modeling transformation cannot be combined with the viewing transformation because rendering calculations such as shading may be needed after the modeling-to-world coordinate transformation. For this reason, matrices pushed on the stack are left undisturbed, and all transformations from modeling coordinates to device coordinates occur in two steps: modeling to world coordinates, followed by world to device coordinates.
If a graphics device is not in MODEL_XFORM mode, the modeling and viewing transformations can be combined. Thus the current viewing transformation matrix is post-concatenated to modeling matrices placed on the matrix stack and subsequent output primitives are transformed using only the top matrix on the matrix stack.
If the matrix stack is empty and this function is called with stack set to REPLACE, a warning is generated and the matrix stack is left unchanged.
All floating point matrices are maintained in 3-Dimensional (4x4) form. If concatenate_matrix2d is called, the elements of xform2 are mapped to a 4x4 matrix for the concatenation as follows:
~~~~~~~~~~~~~~~~ left [ matrix { ccol { a sub 00 above a sub 10 above a sub 20 }
ccol { a sub 01 above a sub 11 above a sub 21 } } right ]~~~~->~~~~
left [ matrix { ccol { a sub 00 above a sub 10 above 0 above a sub 20 }
ccol { a sub 01 above a sub 11 above 0 above a sub 21 }
ccol { 0 above 0 above 1 above 0 }
ccol { 0 above 0 above 0 above 1 } } right ]
Post-concatenation of matrices should be used very carefully. Unless the top matrix on the matrix stack is a modeling matrix (as in MODEL_XFORM mode), it is not device-independent because the post-concatenation occurs after the device transformation (VDC-to-DC). When using this feature, use inquire_size to determine the range of device coordinates.
Perspective transformations (as well as any other non-linear or viewing transformation) should not appear in modeling matrices because they distort surface normals and invalidate lighting calculations. They should instead appear in the viewing transformation that was set with view_transform. When performing perspective transformations, a perspective model where the eye is at origin of perspective space is recommended. Any other model can easily be modified by a single translation step.
Integer transformation matrices are scaled to allow a fractional portion for rotating objects. The radix factor indicates the number of bits to the right of the decimal point. Legal limits are 0 to 30. Once a coordinate has been transformed, it is divided by 2**radix to return to an integer value.
When using raw mode with an integer matrix, the positions (a20) and (a21) have an implied radix factor of 0 (no scaling). This allows large translation ranges along with accurate rotations.
Integer operations are only available when using the INT_XFORM gopen mode. When in INT_XFORM mode, floating point operations are not available for that fildes. Floating point operations are the default, or can be specified with FLOAT_XFORM mode. For a list of integer operations, floating point operations and common operations see the starbase.3g manual page.
LANGUAGE DEPENDENCIES
FORTRAN77:
FORTRAN requires a transposition of array rows and columns due to the manner in which it stores arrays.
SEE ALSO
concat_matrix(3G), flush_matrices(3G), gopen(3G), inquire_sizes(3G), pop_matrix(3G), push_matrix(3G), replace_matrix(3G), view_transform(3G).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992