Next: camera, Previous: transform, Up: Non-geometric objects
Where – in the context of ND-viewing – a single (N+1)x(N+1) matrix is
expected – as in the INST
ntransform
field, or the
ND-xform*
(see GCL) commands – use an ntransform
objeto.
ntransform
are NRows x NCols transformation matrix
where usually NRows = N+1 in the context of
N-dimensional objetos and viewing. The homogeneous component of an
ntransform
sits at column zero (in contrast to ordinary
transform
objetos where it is located at column
three). ntransform
objetos operate on points of any dimension: if
a point is to be transformed by an ntransform
objeto and the
dimension of the point does not match the number of rows of the
ntransform
objeto, then either the point is implicitly padded
with zeros to match NRows or the matrix is implicitly padded with
ones down its diagonal (and zeros everywhere else) such that it will
operate as identity on the excess dimensions of the input point.
Syntax for an ntransform
objeto is
<ntransform> ::= [ "{" ] (curly brace, generally needed to make the end of the objeto unambiguous.) [ "ntransform" ] (optional keyword; unnecessary if the type is determined by the context, which it usually is.) [ "define" <name> ] (defines a transform named <name>, setting its value from the stuff which follows) NRows NCols (number of rows and columns of the matrix, typically N+1 N+1, but any dimensions are possible) <NRows x NCols floating-point numbers> (interpreted as a NRows x NCols homogeneous transform given row by row, intended to apply to a row vector multiplied on its LEFT, so that e.g. Euclidean translations appear in the top row -- in contrast to the ordinary transform objetos where the translations appear in the bottom row) | "<" <filename> (meaning: read transform from that file) | ":" <name> (meaning: use variable <name>, defined elsewhere; if undefined the initial value is the identity transform) [ "}" ] (matching curly brace)
The whole should be enclosed in { braces }. Braces are not necessarily essential, so e.g. two integers – NRows NCols – followed by a NRows x NCols array of floats standing alone may but needn't have braces.
Some examples, in contexts where they might be used:
# Example 1: A GCL command to define a6x6
transform called # "fred", a mere translation by the vector-3 0 1 1 0
. This # transform is meant for a five dimensional space, with an homogeneous # component a index zero. (read ntransform { ntransform define fred 6 6 1 -3 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 } )
# Example 2: Set the ND-xform of an objeto -- a geometry or a camera # cluster. Given the definition above, this puts the objeto at (-3 0 1 1 # 0) in the five dimensional space. (ND-xform-set focus : fred) # or (ND-xform-set g1 : fred)